ExecuteNonQuery() - Bach SQL Statement execution?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am trying to use the ExecuteNonQuery() to execute multiple SQL update
statements. Though the SQL is correct, it only executes the first update
statement. When I looked through the documentation I found out this,
“You can also use ExecuteNonQuery to execute multiple SQL statements if the
underlying ODBC driver supports this functionality.â€
How do I know if my underlying driver supports this?
Is there something I can do to change any setting on the ODBC driver?
Thanks for any help.
 
How do I know if my underlying driver supports this?
Depends on the ODBC driver. I say write up a quick test app and execute a
batched query.
Is there something I can do to change any setting on the ODBC driver?
Again depends on the ODBC driver, but I haven't ever come across such a
setting, and logically it doesn't make any sense to not enable this by
default -- in other words, my hunch is, no such setting exists because it
doesn't seem to make sense.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
Please reply to the newsgroups instead of email so everyone can benefit from
your reply.
 
Thank You Malik.
I did try a batched query with DataReader. Datareader.NextResult doesn't
work.. so my ODBC driver doesn't allow, I guess.
 
Hi,

You would need to check documentation for the ODBC driver, but as I know
only OLEDB for SQL Server provider does it. To test if it supports batches
or not, you would need to separate statements with the semicolon (;) and run
this batch. See what happens. If it does not work this way, than most likely
driver/provider does not support this functionality
 
Back
Top