Stephen_Sbh


Assume that I got 10 line of insert query to be carry out, how can I run all these 10 insert query at on time instead of using sqlcommand.executenonquery for 10 time. Thanks.


Re: Run multiple query on VB 2005

Arnie Rowland


You can create a Stored Procedure that contains all 10 queries, pass all of the necessary parameters to the Stored Procedure, and the execute the Stored Procedure.

Perhaps if you posted your queries, we could better help you.







Re: Run multiple query on VB 2005

StephenSaw

Well, if I got one or two insert query, one or two delete query and some update query, assume that the data validation is valid, could these be carry out together




Re: Run multiple query on VB 2005

Arnie Rowland

Yes.

In the Stored Procedure, if they are 'all or none' actions, you may wish to put all of the queries/actions in a SQL TRANSACTION to make sure that there are no errors.






Re: Run multiple query on VB 2005

StephenSaw

Can I have a sample code on how to execute multiple queries at one time



Re: Run multiple query on VB 2005

Arnie Rowland

Look in Books Online for the topic 'TRANSACTION'. There are several good examples.