hi experts
i m using fallowing code for update, delete and save data
it's working very well when i save new recored but when i update and delete recored it's showing error message
"Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information."

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If thismode = 0 Then
            row = ds.Tables("state").NewRow()
            row.Item("state") = TextBox1.Text
            ds.Tables("state").Rows.Add(row)
        Else
            ds.Tables("state").Rows(thismode).Delete()
            'ds.Tables("state").Rows(thismode).Item("state") = TextBox1.Text
        End If

        cmdb = New SqlCommandBuilder(da)
        da.Update(ds, "state")

        Button2.PerformClick()


    End Sub

please help me soon .

Does the table have a primary key?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.