Hi
I am getting an error while updating a table after modifications...
Can anyone see what exactly is the problem. It gives an error message
"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information." at the place indicated below...
Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'opening databse Dim Con As New OleDb.OleDbConnection Con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Srout\Desktop\Reviews\Reviews\Reviews\table\Review.mdb;Persist Security Info=True;Jet OLEDB:Database Password=magicword" Con.Open() Dim ds As New DataSet Dim da As OleDb.OleDbDataAdapter Dim sql As String sql = "SELECT EmpId, FullNm, RepsTo, MgcWrd, Levell, Statuss, Desg FROM Review" da = New OleDb.OleDbDataAdapter(sql, Con) da.Fill(ds, "Review") Dim cb As New OleDb.OleDbCommandBuilder(da) 'Checkrw is the row where the data has to be inserted. It give me a value betwenn 0 and 8 'as required. i am okay with the value of checkrw. 'MsgBox(checkrw) ds.Tables("Review").Rows(checkrw).Item(0) = Trim(TextBox1.Text) 'Emp ID ds.Tables("Review").Rows(checkrw).Item(1) = Trim(TextBox2.Text) 'FullNm ds.Tables("Review").Rows(checkrw).Item(2) = Trim(ComboBox1.Text) 'RepsTo ds.Tables("Review").Rows(checkrw).Item(3) = "CHANGEME" 'MgcWrd ds.Tables("Review").Rows(checkrw).Item(4) = Mid(Trim(ComboBox2.Text), 7, 1) 'Levell If RadioButton1.Checked = True Then ds.Tables("Review").Rows(checkrw).Item(5) = "Active" 'Status Else ds.Tables("Review").Rows(checkrw).Item(5) = "InActive" 'Status End If ds.Tables("Review").Rows(checkrw).Item(6) = Trim(ComboBox3.Text) 'Desc da.Update(ds, "Review") '<===== ERROR HERE.... MsgBox("User Details have been modified Successfuly") Con.Close() Me.Close() End Sub




Reply With Quote