views:

43

answers:

1

I'm looking at my options here. I would love to know how to write my stored procedures not in the SqlServer but in my app (DB Layer) using SqlHelper?

Can anyone help?

A: 

By SqlHelper do you mean the old, deprecated Patterns & Practices class that is now rolled into the Enterprise Library?

The simple answer is you can't. Stored procedures are, by their definition, stored on the SQL server. If you want to run queries against SQL databases, but don't want to put the queries in the database as stored procedures then you can use the SqlCommand .NET object which the SqlHelper class wrapped.

You should be aware that once you start writing inline SQL like this you must use SqlParameters parametrised queries to avoid SQL injection.

blowdart
You said the days of SqlHelper is gone. May i know why and what has replaced it?
Colour Blend
blowdart
Colour Blend
Yes it does. (damned stupid 15 character minimum comment length)
blowdart