Hi!

I'm having trouble updating the source table with dataset records that have been added (in VB.NET)

I have two databases that I want to merge one table at a time. I'm struggling with table number one.

I manage to get all rows into the "ds" dataset and the rowstate of each is "added".
When I run the update statement I get an error and no update.
I added the command builder because I read somewhere it would automatically generate the necessary SQL statements.

This is the code:

Dim cn As OleDbConnection = New OleDbConnection(strConnection)

strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& TargetDBFullPath

dscmd = New OleDbDataAdapter("SELECT * FROM firsttable", cn)

Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(dscmd)
cn = New OleDbConnection(strConnection)
cn.Open()

cb.QuotePrefix = ("[")
cb.QuoteSuffix = ("]")

ds = New DataSet
dscmd.Fill(ds, "firsttable")

Dim workrow As DataRow

For iCtr = 1 To SourceRecordCount
workrow = ds.Tables("firsttable").NewRow
'set column values
ds.Tables("firsttable").Rows.Add(workrow)
Next

dscmd.Update(ds, "firsttable")
cn.Close()

In the dbs I have a table called "session". Strangely it can't be called that.
If I change the name to "session1" ,for example, no error occurs.
Anyone who knows why?

I would be very happy if someone could help with this.