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:
vb Code:
  1. Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
  2.         Const cSUBNAME As String = "btnSave_Click"
  3.  
  4.         Try
  5.  
  6.             'Open the DataBase connection which will be used to execute the SP
  7.             If DatabaseConnectionOpen() = False Then
  8.                 Call WriteError(cMODULENAME, cSUBNAME, Err.Number, Err.Description)
  9.                 GoTo ExitNow
  10.             End If
  11.  
  12.  
  13.             Dim cb As New SqlCommandBuilder(da)
  14.  
  15.             cb.GetUpdateCommand()
  16.             da.Update(dt)
  17.  
  18.             DatabaseConnectionClose()
  19.  
  20.             FillOperatorGrid()
  21. ExitNow:
  22.         Catch ex As Exception
  23.             Call WriteError(cMODULENAME, cSUBNAME, Err.Number, Err.Description)
  24.         End Try
  25.  
  26.     End Sub
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."

Can anyone enlighten me as to what is wrong please?