Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataSets vs Queries 1

Status
Not open for further replies.

medicenpringles

Programmer
Aug 7, 2005
39
US
I have a couple of different procedures that retrieve data from a single database. Both return a single value, either an Integer or DateTime. But the one that returns an integer accesses the data by connecting to the database and returning the data using .ExecuteScalar, while the other one builds a DataAdapter, a DataSet, and a DataTable, then references the DataTable to get the data.

my question is, is there any advantge to using DataSets over directly query-ing the database?

Main Language: Visual Basic .NET
Development Environment: Visual Studio .NET 2003
 
In your case.

No.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
in other cases,

would there be?

Main Language: Visual Basic .NET
Development Environment: Visual Studio .NET 2003
 
Here are my GENERAL preferences:

1. To return one single value from a database: .ExecuteScalar()
2. To return one row from a database: Used a stored procedure with output parameters, and .ExecuteNonQuery() and check parameter values --OR-- .ExecuteReader()
3. To populate multiple objects with data: .ExecuteReader()
4. To bind data to controls: DataSet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top