Hello all,
In my programs I usually use a recordset to execute a stored procedure in SQL Server. I have seen other programmers use a Command object for executing stored procedures.
I was wondering, is one method was better than the other? If so, why?
I tend to use the Connection object to execute stored procs, rather then the Command object. As far as I know, there's not a huge critical difference between the two - I just prefer the Connection object, because there are less steps to take to actually execute a proc than with the Command object. Personally, for me, less steps = less chance for error, and that's a good thing in my book.
To execute a stored procedure that doesn't send any data, I usually use a command object. Sometimes, if I'm feeling lazy, I will send the connection a string that executes the sp.
If I want to get results back that needn't be more than one row, I usually access them from my output parameters after executing the sp, rather than open a recordset.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.