C # application. Should I use stored procedures or ADO.NET with C # programming methods?

I have a C # application that I create that stores all the data in SQL Server.

Sometimes it's easier for me to make data changes programmatically, and sometimes it's easier to store stored procedures and functions in a SQL Server database and call them.

I am new to programming and I do not know what subtle advantages and / or disadvantages of each method are.

I believe that probably I should do one or the other, and not use multiple methods.

My code begins to look like a random set of thoughts that just cram into one place. Do not be offended by Joel Spolsky. I like his books.

This is a solo project, so I can reorganize any code that I want to do better. All options are on the table.

Thanks,

J3r3myK

+5
source share
5 answers

, Stored Procs /, , ​​ . , , , ( , , , ). , , , - , , , - , - Excel .

, Stored Proc T-SQL, - , . , , ADO.NET SQL, .

Stored Procs - , - proc, proc - # -. "" , 3 . Proc !: -)

: ; , T-SQL, , . , SQL #.

$0,02.

+7

, :

SProcs . , SProcs, .., .

-, sproc , . IO , , ENTIRE, , .

, (.. , ), , SQL, .

+5

, ADO.NET ... , . , , , , , LINQ, , "" (.. Skip/Take/Where/OrderBy ).

, , ( UDF) - ( ).

, .

+4

: , , SP- SP "".
, , SP db.

SP- , :

  • SQL ( #)
  • - ( )
  • , - , db
  • , , sql
  • - , ..

, ( ...). , , / .
, , , - , -.. ...

+2

I would recommend following one convention or another (either having your SQL code as strings in your classes, or using stored procedures). There is endless debate about this, but there really are no important reasons for choosing one or the other.

0
source

All Articles