G
Guest
I have struggled with this all last week, I finally have my code running
without any error generations but zero records are being updated to a simple
Access file. The source table has no relationship and I include the primary
key in my SQL statement. There are no other users to conflict with, the
DataGrid is sucessfully populated with the Source Data. The load code is as
follows:
conn = New OleDbConnections(strPath)
da = New OleDbDataAdapter
da.SelectCommand = New OleDbCommand(strSQL, conn)
da.FillSchema(ds, SchemaType.Source, "SourceTable")
da.Fill(ds, "SourceTable")
ds.DataSetName = "ds_Table"
da.TableMappings.Add("SourceTable", "ds_Table")
cmdBuilder = New OleDbCommandBuilder(da)
With objDataGrid
.DataSource = ds.DefaultViewManager
.SetDataBinding(ds, "SourceTable")
End with
'Datagrid is updated and rows are deleted a Save function is triggered on
close
'by ds.HasChanges but no records are updated or deleted
lngUpdate = da.Update(ds, "SourceTable") 'Returns 0
Debug.WriteLine(cmdBuilder.GetInsertCommand.CommandText)
Debug.WriteLine(cmdBuilder.GetUpdateCommand.CommandText)
Debug.WriteLine(cmdBuilder.GetDeleteCommand.CommandText)
'No Error is generated
I am at a complete loss, I do not understand why the Source Table is not
updated?
Any help would be of great assistance.
without any error generations but zero records are being updated to a simple
Access file. The source table has no relationship and I include the primary
key in my SQL statement. There are no other users to conflict with, the
DataGrid is sucessfully populated with the Source Data. The load code is as
follows:
conn = New OleDbConnections(strPath)
da = New OleDbDataAdapter
da.SelectCommand = New OleDbCommand(strSQL, conn)
da.FillSchema(ds, SchemaType.Source, "SourceTable")
da.Fill(ds, "SourceTable")
ds.DataSetName = "ds_Table"
da.TableMappings.Add("SourceTable", "ds_Table")
cmdBuilder = New OleDbCommandBuilder(da)
With objDataGrid
.DataSource = ds.DefaultViewManager
.SetDataBinding(ds, "SourceTable")
End with
'Datagrid is updated and rows are deleted a Save function is triggered on
close
'by ds.HasChanges but no records are updated or deleted
lngUpdate = da.Update(ds, "SourceTable") 'Returns 0
Debug.WriteLine(cmdBuilder.GetInsertCommand.CommandText)
Debug.WriteLine(cmdBuilder.GetUpdateCommand.CommandText)
Debug.WriteLine(cmdBuilder.GetDeleteCommand.CommandText)
'No Error is generated
I am at a complete loss, I do not understand why the Source Table is not
updated?
Any help would be of great assistance.