473,507 Members | 11,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Advice needed - SQL queries in C#

After messing about I've made some headway towards getting a DataSet filled
with data from an SQL database, unfortunately I've been advised that this
isn't the way forward due to the overhead involved of filling the DataSet
with every page access.

So what method is prefereable to use?

Am I supposed to create a DataAdapter that only fetches a certain query,
dependant on what the users type in fields? Or am I supposed to use a
DataSet in the same way?

The book I bought is pretty useless in the respect that it focuses on the
DataSet as the all-encompasing solution to all your needs. Which I debate
TBH.

All I want to do is execute SQL queries and put the results in to text
boxes, then update the SQL tables with an update query afterwards....

Any advice greatly appreciated.
Rich.
Nov 16 '05 #1
2 969
Kavvy wrote:
After messing about I've made some headway towards getting a DataSet
filled with data from an SQL database, unfortunately I've been advised
that this isn't the way forward due to the overhead involved of filling
the DataSet with every page access.

So what method is prefereable to use?

Am I supposed to create a DataAdapter that only fetches a certain query,
dependant on what the users type in fields? Or am I supposed to use a
DataSet in the same way?

The book I bought is pretty useless in the respect that it focuses on the
DataSet as the all-encompasing solution to all your needs. Which I debate
TBH.

All I want to do is execute SQL queries and put the results in to text
boxes, then update the SQL tables with an update query afterwards....

Any advice greatly appreciated.
Rich.


You could always use a DataReader to get the data.

Then use a stored procedure to update the database.

As I understand it, the DataSet works best when you have a large grid of
data and you want instant updates back to the database. However, the
Update features of the DataSet has to be congruent with the database table.
You can't update a view, or the product of a join, for example.
Nov 16 '05 #2
Kavvy <r@hfeajhjgg.gt> wrote:
After messing about I've made some headway towards getting a DataSet filled
with data from an SQL database, unfortunately I've been advised that this
isn't the way forward due to the overhead involved of filling the DataSet
with every page access.

So what method is prefereable to use?

Am I supposed to create a DataAdapter that only fetches a certain query,
dependant on what the users type in fields? Or am I supposed to use a
DataSet in the same way?
I normally use a DataSet *with* a DataAdapter - or bypass a DataSet
entirely and just use DataTables directly. (I don't think DataSets
really give that much benefit as a collection, but that could just be
due to the apps I happen to have written not needing the extra
functionality.)

You'd normally have a DataAdapter with a command already populated, and
then set the parameter values of that command from what the user types
in.
The book I bought is pretty useless in the respect that it focuses on the
DataSet as the all-encompasing solution to all your needs. Which I debate
TBH.

All I want to do is execute SQL queries and put the results in to text
boxes, then update the SQL tables with an update query afterwards....


To be honest, using a DataSet (or at least a DataTable) is still
probably the way to go. The only other viable alternative would be to
use a DataReader, which doesn't really buy you much - you might get
*slightly* more efficiency, but your code would be longer and more
fragile.

Using DataTable/DataAdapter will make the update much easier, too.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

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

Similar topics

14
3420
by: Jeff Boyer | last post by:
Hello everyone, I have recently developed a web application across my clients intranet. We used ASP with Interdev 6.0 and SQL server as the backend. They have now come to me asking me to...
4
1309
by: Bob | last post by:
Hallo, I have to make a web application in Javascript/ASP for tenniscourt reservation (based on Access database). I would like to do everything with one page, because the user must be able to...
5
1540
by: Joey Martin | last post by:
On my website, I want to provide 3 pieces of statistics that will require 3 queries to my SQL database. As much as I'd like these to be live, they are part of a footer that will load each time for...
5
1719
by: Steve_CA | last post by:
Hello all, I've been recruited to assist in diagnosing and fixing a performance problem on an application we have running on SQL Server 7. The application itself is third party software, so we...
4
3268
by: Koen | last post by:
Hi all, At work I created a database which is really helpful. The database is used by approx 15 users. Everything worked great, until I added some 'scoreboard' forms and reports. I get the...
4
2130
by: Neil Grantham | last post by:
I am creating a database for Nursery children, and part of the reporting requirement, is to show those on the waiting list. Children will be elligible for entry by age, and so based on their...
3
2392
by: dlesandrini | last post by:
I need advice about my decision to go with Replication in general. This post was placed on the Microsoft Replication newsgroup, but I really value the feedback that comes from this group as well. ...
22
2662
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other...
23
2400
by: JohnH | last post by:
I'm just recently come to work for an auto brokerage firm. My position involves performing mysterious rites, rituals and magick in order to get information out of their access database. This is...
0
7223
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
7110
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...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
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
7482
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
5623
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
4702
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
1540
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 ...

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.