Home All Groups Group Topic Archive Search About

Batch execute Stored Procedures with sqlcommand?

Author
2 Mar 2006 11:11 AM
Larry Charlton
Is there a way to send a couple of stored procedure requests in a single
round trip to the sql server if the stored procedures have parameters?

I know I could create a string and send it, but would prefer not to rely on
my ability to correctly handle every problem that might come along.

For instance I can do this:
EXEC sp1 @param='value', @param2='value';
EXEC sp2 @param='value'

In a SqlCommand, but I'd like to do this using the built in parameter
features if possible.  Also the sp's often return datasets, so I need to be
able to navigate through the recordsets.

If the above is the only way to do this, are there any references on what a
safe way to construct that string is so it's not vulerable to various attacks?

I'm trying to batch up most of the stuff I need to do, sending one round
trip to the database, and then doing stuff with the result.

AddThis Social Bookmark Button