Hi,
I guess its all a matter of personal preference really. I think the
general consensus that the best practices is to use stored procs.
The advantage of stored procs is that they're compiled (I believe), and
hence run much faster than a query passed in a string. Plus as they are
doing mainly direct database actions it makes sense that they sit
within the database server.
However, if you are doing many calls to the db server, it may make
sense to wrap the query up into one string and pass that, as the db
server round-trips can be a bottle-neck.
Also, stored procs don't have source control, unlike c# code can have.
Personally I sit in the use stored procs camp. I believe database
functions should sit as close to the db as possible. Plus, you can
still use ADO.NET and all it's functionality with stored procedures -
the only difference being you pass a stored proc name rather than a
string of sql.
I know some developers who prefer using sql queries within their code,
but as far as I can tell it's purely because that's the environment
they are used to and like - unlike sql enterprise manager.
My tuppence worth... hope it's of some help...
Regards,
Peter Chadwick (MCP)
pe**@code-explorers.com