Hi - I'm creating an admin application that will allow specific users to manage users login credentials for an application. On a form I have a datagrid that is populated by selecting * from Operator table on the DB. I want the admin users to be able to add, edit and delete records from the datagrid and i have enabled these properties on the grid but any changes need to be confirmed by clicking a 'Saves Changes' button. Here's the code behind this button:
I have added a new record but when I save these changes I am getting this error: "02/12/2011 11:43:56,frmOperator,btnSave_Click,5,Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."vb Code:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Const cSUBNAME As String = "btnSave_Click" Try 'Open the DataBase connection which will be used to execute the SP If DatabaseConnectionOpen() = False Then Call WriteError(cMODULENAME, cSUBNAME, Err.Number, Err.Description) GoTo ExitNow End If Dim cb As New SqlCommandBuilder(da) cb.GetUpdateCommand() da.Update(dt) DatabaseConnectionClose() FillOperatorGrid() ExitNow: Catch ex As Exception Call WriteError(cMODULENAME, cSUBNAME, Err.Number, Err.Description) End Try End Sub
Can anyone enlighten me as to what is wrong please?




Reply With Quote