Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: store procedure or sql command Pin
AspDotNetDev26-Oct-10 7:36
protectorAspDotNetDev26-Oct-10 7:36 
Stored procedures can help reduce network traffic, as the EXEC statements are typically shorter than the statements in the SP's. Naturally, this depends on if network traffic is an issue at all (e.g., if the SQL runs on the same machine as the C#, it wouldn't be an issue... it also wouldn't be an issue of the data being transferred dwarfs the SQL code size).

DLL's are just as fragile as stored procedures. At my previous job, we had to work with a system that had hundreds of DLL's and OCX's. The systems constantly got out of sync. SP's have one advantage in this respect... you fix them in one location (the database) and they are fixed everywhere. That's kinda nice (at least for systems where there is a primary database server). The other advantage/disadvantage is that you can see the stored procedure code, while it is difficult to see DLL code (without, say, Reflector). That means that you can easily check if the wrong code is in use, but it also means its more tempting for others to modify it on the spot without bothering with version control.

PIEBALDconsult wrote:
I have had stored procedures "just disappear"


SP's should be kept under version control. Sadly, the tools to do this are not excellent. Though, I remember a tool from Redgate under development that is supposed to help with this.

PIEBALDconsult wrote:
Stored procedures are too easy to change in the field.


Shhh, don't tell this to Microsoft... they might think making things "too easy" is a bad idea. Poke tongue | ;-P

Depending on the scenario, this may actually be a good thing. Rather than trying to deploy the code to each computer that uses it, you can simply update the SP's on the server and you're done. This also brings up security concerns. It can be difficult or impossible to control security if you allow the clients to run arbitrary SQL statements. If you have stored procedures, you can control exactly what executes on the server. This is a very important point, as it may be the single greatest advantage stored procedures have over plain SQL code.

PIEBALDconsult wrote:
one reason people insist on stored procedures is because they force the developer to use parameters


C#
string firstName = "'; DROP TABLE Whatever; --";
string cmd = "EXEC SelectData '" + firstName + "'";


Both stored procedures and plain SQL are susceptible to SQL injection.

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 
AnswerRe: About generics Pin
J4amieC25-Oct-10 23:40
J4amieC25-Oct-10 23:40 

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.