Home All Groups Group Topic Archive Search About

Successfully executing queries

Author
17 Apr 2006 2:30 AM
John
Hi

I need to run separate insert & update queries. I suppose I can use
execute.nonquery to execute the queries. How can I tell if the queries were
successful?

Thanks

Regards

Author
17 Apr 2006 3:08 AM
Sahil Malik [MVP C#]
The simplest way is to check the return value of that method, and see the
number of rows affected. Alternatively, you could add some exception
throwing stuff in your SQL commands.

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
__________________________________________________________



Show quote
"John" <John@nospam.infovis.co.uk> wrote in message
news:uqS5wbcYGHA.3704@TK2MSFTNGP03.phx.gbl...
> Hi
>
> I need to run separate insert & update queries. I suppose I can use
> execute.nonquery to execute the queries. How can I tell if the queries
> were successful?
>
> Thanks
>
> Regards
>
Author
17 Apr 2006 5:27 AM
Cor Ligthert [MVP]
John,

Be aware that if you do use the executenonquery to update, than you have not
the inbuild concurency checking from the dataadapter. (checking if the old
is not already changed).

Just as little warning,

Cor

Show quote
"John" <John@nospam.infovis.co.uk> schreef in bericht
news:uqS5wbcYGHA.3704@TK2MSFTNGP03.phx.gbl...
> Hi
>
> I need to run separate insert & update queries. I suppose I can use
> execute.nonquery to execute the queries. How can I tell if the queries
> were successful?
>
> Thanks
>
> Regards
>

AddThis Social Bookmark Button