Hi all,
On a button click event, I have written the following the code to update the database:
VB Code:
Dim r As DataRow, MyDataAdapter as OleDbDataAdapter MyDataAdapter = New OleDbDataAdapter MyDataAdapter.SelectCommand = New OleDbCommand("select * from Results where code = '" & Code & "'", cnMyConnection) dsMyDataSet = New DataSet MyDataAdapter.Fill(dsMyDataSet) With dsMyDataSet.Tables(0) If .Rows.Count = 0 Then r = .NewRow r("Code") = Code r("First Name") = txtFName.Text r("Right issue") = txtLName.Text .Rows.Add(r) Else .Rows(0).Item("First Name") = txtFName.Text .Rows(0).Item("Last Name") = txtLName.Text End If Try MyDataAdapter.Update(dsMyDataSet) Catch ex As Exception MsgBox(ex.Message) End Try End With
When the Update method is called, it gives me error: "Invalid INSERT INTO statement".
Am I doing anything wrong?
Pls guide




Reply With Quote