fill recordset via execute command | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

fill recordset via execute command

We are "restyling" our ado classes.
I wondered what the best way is to open/fill a recordset… Just via oRec.Open() or via oRec = oCommand.Execute() Considering a. performance and b. error handling tia,
It’s just a question of personal style really.
You can pass a command object to the method or you can set it to the results of a command there is no significant performance gain of one over the other. If you use the method with a sql string as the source then behind the scenes ADO will actually create its own command object and execute it which is exactly the same as using command.execute. As far as error handling is concerned there isn’t I don’t think there’s any difference either, if you’re using a connection object then all errors should be reported in the Errors collection in the connection object regardless of which way you execute your commands. I use commands most of the time because they’re great for setting up parameters for stored procedures and make the code a little more structured and readable. HTH Cheers
Shaun World Domination Through Superior Software
And if you are in a web environment you should in 99% of the cases return all queries as clientside disconnected recordsets for best performance. /Argyle