473,511 Members | 15,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Nov 29 '07 #1
4 1453
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).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Andy B" <a_*****@sbcglobal.netwrote in message
news:uq**************@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.

Nov 29 '07 #2
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

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Andy B" <a_*****@sbcglobal.netwrote in message
news:uq**************@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.

Nov 29 '07 #3
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.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
"Andy B" <a_*****@sbcglobal.netwrote in message
news:uq**************@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.

Nov 29 '07 #4
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

"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.
Nov 29 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
460
by: LineVoltageHalogen | last post by:
Greetings All, currentley there is a heated discussion in my place of work over which method is better/more efficient for simple selects. Background: 1.) Simple Application that uses sql server...
1
1537
by: VM | last post by:
I'm working on a win appication that is constantly querying a small-sized DB. Until now, I've been using Selects from within my app but, all of a sudden I remembered of an application I was...
45
3361
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
2
1583
by: Roy | last post by:
Hey all, Here's a small VB codeblock that connects to a database and uses 2 SQL queries then forms a relation for a master/detail view on the aspx side: Private Sub Binddata(ByVal name As...
9
1878
by: Ronald S. Cook | last post by:
What do you guys think of abandoning stored procedures and writhing the SQL in code? I'm a little new to the debate and not sure I totally understand. From my command object, I can just select...
2
1769
by: Andy B | last post by:
Is there an easy way to convert tableAdaptor queries into stored procs without messing up the dataTables in the dataSet or losing the queries themselves?
1
1251
by: Andy B | last post by:
Hi... I have a dataset with queries in them. I want to switch out the queries for stored procs. When I tried to redefine the select query as a stored proc, I get this error: Cannot remove...
8
2616
by: Frank Calahan | last post by:
I've been looking at LINQ and it seems very nice to be able to make queries in code, but I use stored procs for efficiency. If LINQ to SQL only works with SQL Server and stored procs are more...
5
4056
by: Bogdan | last post by:
Hi, I have a stored procedure that uses JOINs to return columns from multiple tables. I also have another stored proc that that takes a series of params and updates multiple tables. I used the...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7508
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.