Hi all,

On a button click event, I have written the following the code to update the database:
VB Code:
  1. Dim r As DataRow, MyDataAdapter as OleDbDataAdapter
  2.         MyDataAdapter = New OleDbDataAdapter
  3.         MyDataAdapter.SelectCommand = New OleDbCommand("select * from Results where code = '" & Code & "'", cnMyConnection)
  4.         dsMyDataSet = New DataSet
  5.         MyDataAdapter.Fill(dsMyDataSet)
  6.         With dsMyDataSet.Tables(0)
  7.             If .Rows.Count = 0 Then
  8.                 r = .NewRow
  9.                 r("Code") = Code
  10.                 r("First Name") = txtFName.Text
  11.                 r("Right issue") = txtLName.Text
  12.                 .Rows.Add(r)
  13.             Else
  14.                 .Rows(0).Item("First Name") = txtFName.Text
  15.                 .Rows(0).Item("Last Name") = txtLName.Text
  16.             End If
  17.             Try
  18.                 MyDataAdapter.Update(dsMyDataSet)
  19.             Catch ex As Exception
  20.                 MsgBox(ex.Message)
  21.             End Try
  22.         End With

When the Update method is called, it gives me error: "Invalid INSERT INTO statement".

Am I doing anything wrong?

Pls guide