CommandBuilder commands

  • Thread starter Thread starter Konrad
  • Start date Start date
K

Konrad

Hi

How or where can I see full used commands generated
via CommandBuilder for DataAdapter.
Using DataAdapter not CommandBuilder?

Thanks
Konrad
 
Konrad said:
Hi

How or where can I see full used commands generated
via CommandBuilder for DataAdapter.
Using DataAdapter not CommandBuilder?

If the DataAdapter needs a command that it doesn't have, it will invoke the
CommandBuilder to create one.

If you need to see the command ( and perhaps modify it ) before the
DataAdapter uses it, you can invoke the CommandBuilder yourself.

Just use CommandBuilder.GetXXXCommand, optionally edit the command, and pass
the command to the DataAdapter.

eg


dim cb as new SqlCommandBuilder(da)
.. ..
Dim cmd As SqlCommand = cb.GetInsertCommand
cmd.CommandText = cmd.CommandText & "; set @newid = SCOPE_IDENTITY()"
Dim pNewID As SqlParameter = New SqlParameter("@newid", SqlDbType.Int)
pNewID.Direction = ParameterDirection.Output
pNewID.SourceColumn = "ID"

to return the new ID column into the dataset.
 
Debug.WriteLine(myCommandBuilder.GetDeleteCommand())

....GetSelectCommand()
....GetUpdateCommand()

If you use the DataAdapter Configuration wizard, look for its Select,
Update, Delete COmmands respectively....they will be in the form that you
dragged the adapter onto.

HTH,

Bill
 
Great answers, guys! Thanks for posting.

Steven Bras, MCSD
Microsoft Developer Support/Data Access Technologies

This posting is provided "AS IS" with no warranties, and confers no rights.

Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-026?  If not Microsoft strongly advises you to
review the information at the following link regarding Microsoft Security
Bulletin MS03-026
http://www.microsoft.com/security/security_bulletins/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026.
 
Take a look at my article on using (or not using) the CommandBuilder. See
http://www.betav.com/msdn_magazine.htm

--
____________________________________
Bill Vaughn
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top