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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do I even need a DataSet?

Status
Not open for further replies.

aviles1973

Programmer
May 19, 2002
25
US
I am using these OBJECTS without using VB.net wizards to connect and manipulate my database(SQLServer2005):

m_cnADONetConnection As New SqlClient.SqlConnection()

m_daDataAdapter As SqlClient.SqlDataAdapter

m_cbCommandBuilder As SqlClient.SqlCommandBuilder

m_dtContacts As New DataTable

I can pretty much do everything I need to control my database with just the objects above.

I am just very curious of whether or not a DataSet object is ever even needed and the difference between DataTables & DataSets?

I already know that a DataTable is a disconnected copy of the database. Is this also how the DataSet works and would my program run faster using DataSets as the data capacity increases?
 
A DataSet is essentially a collection of DataTables. You can have one or more DataTables in a DataSet. There are many things you can do with a DataSet that you cannot do with a DataTable. Some of them are:

Relate two or more tables together in a Parent/Child relationship.

Merge two DataSets so that the data from the table(s) of one is added to the table(s) of another.

That being said, a DataSet is larger than a DataTable, and if speed is a consideration in your program you can get somewhat of a boost using DataTables instead of DataSets.

In the end, it is like most other things in any programming language. There are certain things that work well in certain situations, while other things are best in different situations. It all depends on what you are trying to accomplish.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top