Command builder question

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
 
R

Reece Laurie

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...
 

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