Click here to Skip to main content
15,900,906 members
Home / Discussions / C#
   

C#

 
GeneralRe: store procedure or sql command Pin
sa.alavifar25-Oct-10 22:20
sa.alavifar25-Oct-10 22:20 
GeneralRe: store procedure or sql command Pin
Pete O'Hanlon25-Oct-10 22:25
mvePete O'Hanlon25-Oct-10 22:25 
GeneralRe: store procedure or sql command Pin
OriginalGriff25-Oct-10 23:21
mveOriginalGriff25-Oct-10 23:21 
GeneralLittle Bobby Tables Pin
Keith Barrow26-Oct-10 1:39
professionalKeith Barrow26-Oct-10 1:39 
GeneralRe: Little Bobby Tables Pin
OriginalGriff26-Oct-10 1:46
mveOriginalGriff26-Oct-10 1:46 
GeneralRe: Little Bobby Tables Pin
Keith Barrow26-Oct-10 2:18
professionalKeith Barrow26-Oct-10 2:18 
GeneralRe: Little Bobby Tables Pin
OriginalGriff26-Oct-10 2:23
mveOriginalGriff26-Oct-10 2:23 
AnswerRe: store procedure or sql command Pin
PIEBALDconsult26-Oct-10 3:28
mvePIEBALDconsult26-Oct-10 3:28 
0) I haven't written a stored procedure since I started using ADO.net. Before that, with ODBC, I had to write stored procedures in order to have transactions -- that was the only reason we used stored procedures.

1) Stored procedures are not inherently faster than SQL in code.[^]

2) Stored procedures offer some benefits, but I doubt most people capitalize on them (I wouldn't).

3) If you use stored procedures, you still need to have SQL (EXEC statements basically) in code anyway.

4) Most people write stored procedures simply because someone else said they should, not because they know what they're doing.

5) A properly-developed Data Access Layer may remove any need for stored procedures. If there is a need, then stored procedures may be used by the DAL and such details will be hidden from the user.

6) Stored procedures are fragile.

6.1) I have had stored procedures "just disappear" (that was with SQL Server 6, I doubt the problem still exists, but it makes me nervous).

6.2) Stored procedures are too easy to change in the field. All code changes should be in source control, properly built, and deployed to the field in a controlled manner. SQL in code accomplishes that.



As mentioned, you absolutely must use parameterized statements. I think one reason people insist on stored procedures is because they force the developer to use parameters. But inline SQL can (and should) use parameters and a well-disciplined developer will have no trouble doing so. I have written several families of classes that make data access with parameters a no-brainer. Here[^]'s one.
GeneralRe: store procedure or sql command Pin
AspDotNetDev26-Oct-10 7:36
protectorAspDotNetDev26-Oct-10 7:36 
GeneralRe: store procedure or sql command Pin
PIEBALDconsult26-Oct-10 15:27
mvePIEBALDconsult26-Oct-10 15:27 
AnswerRe: store procedure or sql command [modified] Pin
RaviRanjanKr26-Oct-10 4:38
professionalRaviRanjanKr26-Oct-10 4:38 
GeneralRe: store procedure or sql command Pin
AspDotNetDev26-Oct-10 7:14
protectorAspDotNetDev26-Oct-10 7:14 
AnswerRe: store procedure or sql command Pin
brunoseixas28-Oct-10 5:29
brunoseixas28-Oct-10 5:29 
QuestionAbout generics [solved] Pin
E. del Ayre25-Oct-10 16:27
E. del Ayre25-Oct-10 16:27 
AnswerRe: About generics Pin
PIEBALDconsult25-Oct-10 16:58
mvePIEBALDconsult25-Oct-10 16:58 
GeneralRe: About generics Pin
Luc Pattyn25-Oct-10 17:00
sitebuilderLuc Pattyn25-Oct-10 17:00 
GeneralRe: About generics Pin
E. del Ayre25-Oct-10 17:01
E. del Ayre25-Oct-10 17:01 
GeneralRe: About generics Pin
PIEBALDconsult25-Oct-10 17:37
mvePIEBALDconsult25-Oct-10 17:37 
GeneralRe: About generics Pin
Xmen Real 25-Oct-10 17:43
professional Xmen Real 25-Oct-10 17:43 
GeneralRe: About generics Pin
Keith Barrow26-Oct-10 1:36
professionalKeith Barrow26-Oct-10 1:36 
AnswerRe: About generics Pin
Mirko198025-Oct-10 22:42
Mirko198025-Oct-10 22:42 
GeneralRe: About generics Pin
E. del Ayre25-Oct-10 23:19
E. del Ayre25-Oct-10 23:19 
GeneralRe: About generics Pin
E. del Ayre25-Oct-10 23:25
E. del Ayre25-Oct-10 23:25 
GeneralRe: About generics Pin
harold aptroot25-Oct-10 23:22
harold aptroot25-Oct-10 23:22 
GeneralRe: About generics Pin
E. del Ayre25-Oct-10 23:27
E. del Ayre25-Oct-10 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.