views:

29

answers:

0

I am using visual basic for coding. Here's my code.

Protected Sub savebutton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles savebutton.Click

      Try
            conSQL.Open()

Dim cmd As New SqlCommand("select * from Phd_Student where student_id = '" + Session("idno") + "'", conSQL)

            Dim builder = New SqlCommandBuilder(da)

            da.SelectCommand = cmd

            da.Fill(ds, "saveStudentTable")

            Dim row As DataRow = ds.Tables("saveStudentTable").Rows(0)



            row("student_id") = studentidTextBox.Text
            row("student_name") = studentnameTextBox.Text
            row("student_email") = studentemailTextBox.Text


            da.Update(ds, "saveStudentTable")

I get an error on this line -> Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information

        Finally
            conSQL.Close()
        End Try
 End Sub