displaying the sql commands generated by commandbuilder?

C

cj

I'm using the commandbuilder to generate insert commands for some tables
for me. I provided it the select command "select * from mytable". I've
used this on several tables and it was building the appropriate insert
command correctly. Then I hit a table where it gave me the error:
"Update error: Incorrect syntax near the keyword 'desc'."

I have a good idea what is going wrong as there is a field in this table
named desc but there is no need for the keyword desc in the insert
command. I'd like to see exactly what it is trying to use as an insert
command. I tried setting a breakpoint and then in the command window
typing "? mysqladapter.insetcommand.commandtext" but it comes back with
a value of 'Nothing' How can I see what the insert command is?
Preferably in code so I might modify it at runtime to correct the problem.
 
J

Jeffrey Tan[MSFT]

Hi,

Thanks for your post.

Yes, Command Builder is just a listener on the updating operation, we can
use SqlCommandBuilder.GetInsertCommand().CommandText to get the generated
insert command text.

Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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