db problem

Hello,

Using this code:

Dim oConn As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" & sPath)
oAdapter = New OleDb.OleDbDataAdapter()
oAdapter.SelectCommand = New OleDb.OleDbCommand("SELECT * FROM NoteTable", oConn)
oCommandBuilder = New OleDb.OleDbCommandBuilder(oAdapter)
oDataSet = New DataSet()
oDataSet.Tables.Add(oTable.Copy)
oAdapter.Update(oDataSet)
Catch e As System.Exception
ExceptionManager.Publish(e)
sString = oAdapter.Update(oDataSet).ToString
MsgBox("Error occurred in procedure DBUpdateSAMNotesTable. The error is '" & e.ToString)
End Try



I am getting the following error message:

"The error is Syntax error in INSERT INTO statement.

Could someone tell me how to display the INSERT INTO statement? Since I am not building it myself it is hard for me to figure out what is wrong with the code. Similar code seems to work fine elsewhere.

Thanks!


Comments

  • First of all ,i hope oTable.Copy is declared properly.

    Anyway ,you can check the InsertCommand,UpdateCommand created by OleDbCommandBuilder using:-

    dim c as oledb.Oledbcommand
    c = oAdapter.insertcommand
    messagebox.show(c.commandtext)

    c = oAdapter.updatecommand
    messagebox.show(c.commandtext)


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion