0

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 .

Edited by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Ranx
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.