HighTechTalks DotNet Forums  

Command builder question

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Command builder question in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
John
 
Posts: n/a

Default Command builder question - 03-13-2010 , 07:36 PM






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

Reply With Quote
  #2  
Old   
Reece Laurie
 
Posts: n/a

Default Re: Command builder question - 03-23-2010 , 12:34 PM






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/library/system.data.oledb.oledbcommandbuilder.getdeletecom mand%28VS.71%29.aspx
-- second paragraph of the Remarks section notes doing this type of
action...




"John" <info (AT) nospam (DOT) infovis.co.uk> wrote

Quote:
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


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.