Creating a new row and edit a row

W

Warex

I am banging my head agaisnt the wall, how do I add a new row and edit a
row?
Below is the code I am trying to use, it keeps throwing an exception abount
no insert command. Any ideas about this?
thnks
Dim mDBN As String = "C:\BNM.MDB"

Dim cCON As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mDBN
& ";Persist Security Info = False"

Dim mSQL As String = "SELECT * FROM Numbers"

Dim cn As New OleDb.OleDbConnection(cCON)

Dim DA As New OleDb.OleDbDataAdapter(mSQL, cn)

Dim DS As New DataSet

DA.FillSchema(DS, SchemaType.Source, "Numbers")

DA.Fill(DS, "Numbers")

Dim CBA As New OleDb.OleDbCommandBuilder(DA)

DA.UpdateCommand = CBA.GetUpdateCommand

Dim DT As New DataTable

DT = DS.Tables("Numbers")

Dim DR As DataRow

DR = DS.Tables("Numbers").NewRow

DR.BeginEdit()

DR("Number") = "OKAY DOO"

DR.EndEdit()

DS.Tables("Numbers").Rows.Add(DR)

DA.Update(DS, "Numbers")
 
W

Warex

heres the exact error message;
it happens as son as I call update
ErrorCode=-2147217900
Message="Syntax error in INSERT INTO statement."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top