Command builder question

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am using below code to automatically generate commands via command
builder.

QuerySt = "SELECT <fiedl list> FROM ..."
CompanyAdapter = New OleDbDataAdapter(QuerySt, LocalConn)
CompanyBuilder = New OleDbCommandBuilder(CompanyAdapter)
CompanyAdapter.Fill(CompanyTable)

Is there a way to take command builder generated INSERT/UPDATE/DELETE
commands, modify them and get data adapter to use the modified command
instead of the command builder generated commands?

Thanks

Regards
 
Hi,

The OleDbCommandBuilder has GetInsertCommand(), GetUpdateCommand(), and
GetDeleteCommand() which each returns an OleDbCommand object. You can then
modify the command object as needed and explicitly set it to the appropriate
OleDbDataAdapter property (OleDbDataAdapter.InsertCommand,
OleDbDataAdapter.UpdateCommand, or OleDbDataAdapter.DeleteCommand).

http://msdn.microsoft.com/en-us/lib...dbcommandbuilder.getdeletecommand(VS.71).aspx
-- second paragraph of the Remarks section notes doing this type of
action...
 
Back
Top