Quick Search for:  in language:    
beginners,defination,datasets,dataset,does,di
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
.Net Stats

 Code: 157,764. lines
 Jobs: 470. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for .Net.
On The Fly Image Resizing, And Saveing
By Chris Hood on 1/27


Click here to see a screenshot of this code!Zip/View Project
By Mähr Stefan on 1/27

(Screen Shot)

Quick Audit
By Thomas Michael McGeown on 1/27


Click here to see a screenshot of this code!Kill Timer
By Adam( ) on 1/26

(Screen Shot)

Fibonacci Function
By Paddy Pasqualmie on 1/25


ID3v1.1 Reader
By Lewis Moten on 1/25


Click here to see a screenshot of this code!Lotto Picker
By Mick Doherty on 1/24

(Screen Shot)

Load a PopUnder using InternetExplore r
By Norberto Olazabal on 1/23


Stack
By Amit Malhotra on 1/23


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

Datasets

Print
Email
 

Submitted on: 9/16/2003 5:40:02 AM
By: Jeff Brown 
Level: Intermediate
User Rating: Unrated
Compatibility:VB.NET, ASP.NET, C++.NET

Users have accessed this article 2642 times.
 
(About the author)
 
     A beginners defination to datasets, what is a dataset and how does it differ from a database.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.

Let see where to start. When .Net was introduced it wreaked havoc on a lot of developers and especially people that where caught still in the VB6 learning curve. I know anyone who already has dealt with dataset objects will now these things. But for the beginner here goes.

A dataset is merely a “in memory” copy of the data you specify using your data adapter. Let me elaborate.

 

First you will need a connection

Dim conntrans as new oledbconnection

Or you could drag it from the “data” toolbox and the interface will come up asking you to which data source you want to connect. For a single tier program this is the way to go.

 

After you get your connection set up and tested, you will need a data adapter, which is basically a query on your database, the data adapter wizard will help you set this up and then you can take a peek in the #windows form generated region to see what code is involved in this.

 

Now for your dataset, the easiest way to get your dataset is to right click your adapter object and click generate dataset. After specifying a name for your dataset you will see that it adds a schema xml file with that name and that your dataset has that name with a “1” appended to it.

 

In the form load event of the form containing your dataset, you must fill it, Yeah kinda looks like it would auto fill when called , but I guess not. To do this you call

Dataadaptername.fill(datasetname)

Replacing the dataset name and data adaptername with your names.

 

Now here is the good part, any changes you make or records you add or not uploaded to the database until you call the acceptchanges() procedure, this is because it is still a disconnected dataset. There are gobs of methods & properties (merge, haschanges, etc etc)  that can be called but for the most part they are accepting changes, rejecting changes or updating the disconnected data.

 

You are now able to bind objects to that dataset; textboxes, combo boxes, etc. also note that a combo box can easily be bound to two datasets. One for the items in it by setting the data source and then the display member & value member, and the selectedItems property in the data bindings can be set to yet another dataset.

 

 I am in the middle of programming a 4-tier application that has a Win32, Intranet & internet interfaces and once done I will post a whole entire tutorial on data access layers and their functions relating to re-usable code. I just felt the need to answer this so that people would know what a dataset is.

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
10/3/2003 8:02:15 AM:
Your explanation makes me understand the use of Dataset and dataadapter, but I have one question to ask: I'm working on a tree tier application and everytime I send my dataset to my data layer and call the update method, it does not update, please help on this
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | .Net Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.