J
John Cosmas
I have a DATATABLE which I have populated in my application, and I need it
written out to a particular table I specify in my ACCESS database. My code
works to the point of the MERGE and UPDATE, but it creates exactly the
number of BLANK records per the populated DATATABLE. Here is my code...
pstrDestinationTable = "tws_tbl_Case_Scanner_" &
GetDateTimeStamp()
pstrSQL = "SELECT * INTO " & pstrDestinationTable & " FROM
tws_tbl_Case_Scanner"
pobjCmdEventLog = New
System.Data.OleDb.OleDbCommand(pstrSQL, pobjConnection)
pobjCmdEventLog.ExecuteNonQuery()
pstrSQL = "SELECT * FROM " & pstrDestinationTable
pobjCmdEventLog = New
System.Data.OleDb.OleDbCommand(pstrSQL, pobjConnection)
pobjAdpEventLog = New
System.Data.OleDb.OleDbDataAdapter(pobjCmdEventLog)
'Dim pobjDataTable As System.Data.DataTable = New
System.Data.DataTable
pobjAdpEventLog.Fill(gdsTWWData, pstrDestinationTable)
gdsTWWData.Tables(pstrDestinationTable).Merge(gdsTWWData.vdtCaseScanner,
True)
Dim pobjCmdBuilder As System.Data.OleDb.OleDbCommandBuilder
pobjCmdBuilder = New
System.Data.OleDb.OleDbCommandBuilder(pobjAdpEventLog)
pobjAdpEventLog.InsertCommand =
pobjCmdBuilder.GetInsertCommand()
'pobjAdpEventLog.UpdateCommand =
pobjCmdBuilder.GetUpdateCommand()
pobjAdpEventLog.Update(gdsTWWData.Tables(pstrDestinationTable))
gdsTWWData.Tables(pstrDestinationTable).AcceptChanges()
What my code is intended to do is to create a DUMP of my populated DATATABLE
an put it into a named table in my ACCESS database. That is why the use of
the PRSTDESTINATIONTABLE is specific. At the completion of the MERGE
command, I did notice that the other COLUMNS in the PRSTDESTINATIONTABLE is
BLANK/NULL. The schemas of both DATATABLE (SOURCE and DESTINATION) are
identical. Please help.
TIA
John
written out to a particular table I specify in my ACCESS database. My code
works to the point of the MERGE and UPDATE, but it creates exactly the
number of BLANK records per the populated DATATABLE. Here is my code...
pstrDestinationTable = "tws_tbl_Case_Scanner_" &
GetDateTimeStamp()
pstrSQL = "SELECT * INTO " & pstrDestinationTable & " FROM
tws_tbl_Case_Scanner"
pobjCmdEventLog = New
System.Data.OleDb.OleDbCommand(pstrSQL, pobjConnection)
pobjCmdEventLog.ExecuteNonQuery()
pstrSQL = "SELECT * FROM " & pstrDestinationTable
pobjCmdEventLog = New
System.Data.OleDb.OleDbCommand(pstrSQL, pobjConnection)
pobjAdpEventLog = New
System.Data.OleDb.OleDbDataAdapter(pobjCmdEventLog)
'Dim pobjDataTable As System.Data.DataTable = New
System.Data.DataTable
pobjAdpEventLog.Fill(gdsTWWData, pstrDestinationTable)
gdsTWWData.Tables(pstrDestinationTable).Merge(gdsTWWData.vdtCaseScanner,
True)
Dim pobjCmdBuilder As System.Data.OleDb.OleDbCommandBuilder
pobjCmdBuilder = New
System.Data.OleDb.OleDbCommandBuilder(pobjAdpEventLog)
pobjAdpEventLog.InsertCommand =
pobjCmdBuilder.GetInsertCommand()
'pobjAdpEventLog.UpdateCommand =
pobjCmdBuilder.GetUpdateCommand()
pobjAdpEventLog.Update(gdsTWWData.Tables(pstrDestinationTable))
gdsTWWData.Tables(pstrDestinationTable).AcceptChanges()
What my code is intended to do is to create a DUMP of my populated DATATABLE
an put it into a named table in my ACCESS database. That is why the use of
the PRSTDESTINATIONTABLE is specific. At the completion of the MERGE
command, I did notice that the other COLUMNS in the PRSTDESTINATIONTABLE is
BLANK/NULL. The schemas of both DATATABLE (SOURCE and DESTINATION) are
identical. Please help.
TIA
John