|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
stored Procs or dataSet queries?Where would probably be the best place for queries to the database? in the
db as stroed procs or in the dataSet. Hi,
The dataset is the result of a query to the DB :) Maybe what you meant is a SP vs a query. Personally I prefer using SP. but sometimes is easier to build the query, especially if you need some complex combination of where/sort by clauses Show quote "Andy B" <a_bo***@sbcglobal.net> wrote in message news:uq7$TtpMIHA.4228@TK2MSFTNGP02.phx.gbl... > Where would probably be the best place for queries to the database? in the > db as stroed procs or in the dataSet. > Andy,
Personally, I prefer them in the database, as it makes them more managable. Also, it provides an API layer in case you have to do multiple-query work in the stored procedure to produce the output for your query (as opposed to a single query that you are sending). -- Show quote- Nicholas Paldino [.NET/C# MVP] - mvp@spam.guard.caspershouse.com "Andy B" <a_bo***@sbcglobal.net> wrote in message news:uq7$TtpMIHA.4228@TK2MSFTNGP02.phx.gbl... > Where would probably be the best place for queries to the database? in the > db as stroed procs or in the dataSet. > The TableAdapters are nice (ie, in the DataSet), but far more useful when
you can separate out the definition from the data access, which requires ..NET Framework 3.5/Visual Studio 2008. I generall do not head this direction, but I am not against it, as it performs rather nicely. If you go the database route, I would code as stored procedures. I know there are others who will disagree with me on this, but it is easier, esp. when learning, to secure sprocs than it is to secure code in objects served up by a factory method, etc. The stored procedure also acts as an abstraction as long as you are using a relational server that allows sprocs, as you can change the driver/provider and still query. This is not always true in practice, although it is in theory (Oracle, for example, requires passing in a structure for output when using the OracleClient objects). One thing the abstraction does allow, however, is altering schema underneath the sprocs, so you can version your database without impacting application logic. -- Show quoteGregory A. Beamer MVP, MCP: +I, SE, SD, DBA ************************************************* | Think outside the box! | ************************************************* "Andy B" <a_bo***@sbcglobal.net> wrote in message news:uq7$TtpMIHA.4228@TK2MSFTNGP02.phx.gbl... > Where would probably be the best place for queries to the database? in the > db as stroed procs or in the dataSet. > I agree with Gregory, although this all smacks of the "Stored Procedures are
Evil" debate. Stored procs are not evil. --Peter "Inside every large program, there is a small program trying to get out." http://www.eggheadcafe.com http://petesbloggerama.blogspot.com http://www.blogmetafinder.com Show quote "Andy B" wrote: > Where would probably be the best place for queries to the database? in the > db as stroed procs or in the dataSet. > > > |
|||||||||||||||||||||||