Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim intClassID As Integer = Convert.ToInt32(ddlstclass.SelectedItem.Value)
Dim intCourseID As Integer = Convert.ToInt32(ddlstcourse.SelectedItem.Value)
Dim intTeacherID As Integer = Convert.ToInt32(ddlstTea.SelectedItem.Value)
Dim intTerm As String = TextBox1.Text
Dim conn As New SqlConnection
conn.ConnectionString = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString
Dim i As Integer
For i = 0 To gvstu.Rows.Count - 1
Dim lbl1 As Label
lbl1 = gvstu.Rows.Item(i).FindControl("Label1")
Dim intStudentID As Integer = Convert.ToInt32(lbl1.Text)
intStudentID = Convert.ToInt32(lbl1.Text)
Dim strsql As String = "insert into Score(studenID,courseID,TeacherID,Term) values(" & intStudentID & "," & intCourseID & "," & intTeacherID & ",'" & intTerm & "')"
Dim cmd As New SqlCommand(strsql, conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Next
End Sub