Total Page Preview:   000000043698

Difference between DataSet and DataTable in c# with example


DataTable

DataTable represents a single table in the database. It has rows and columns. There is no much difference between dataset and datatable, dataset is simply the collection of datatables.


In Hindi

"Database me DataTable ek single table ko represent karta hai. esme rows and columns hote hai. DataSet and DataTable me koi jyada difference nahi hota hai, dataset sirf datatables ka collection hota hai"

Example:

//Get sql database connection
SqlConnection conn = new SqlConnection ("Data Source=127.0.0.1;Integrated ecurity=true;Initial Catalog=TestDB" );
conn.Open();
SqlCommand cmd = new SqlCommand("Select UserName, First Name,LastName,Location FROM Users" , conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
//Create object to DataTable
da.Fill(dt); //Fill User Data in DataTable

DataSet

DataSet is a disconnected orient architecture that means there is no need of active connections during work with datasets and it is a collection of DataTables and relations between tables. It is used to hold multiple tables with data. You can select data form tables, create views based on table and ask child rows over relations. Also DataSet provides you with rich features like saving data as XML and loading XML data.

In Hindi

"DataSet ek disconnected orient architecture hota hai, iska matlab yah hai ki datasets ke sath kaam karne ke liye koi active connections ki jarurat nahi hoti hai aur yah tables ke bich DataTables and relations ka ek collection hota hai. Yah multiple tables ke sath data ko rakhne ke liye use hota hai. Tum tables se data ko select kar sakte ho, table par based views create kar sakte ho aur relations ke upar child rows ko ask kar sakte ho. DataSet tumhe bahut sare features provide karta hai like saving data as XML and loading XML data"

Example:


//Get sql database connection
SqlConnection conn = new SqlConnection ("Data Source=127.0.0.1;Integrated ecurity=true;Initial Catalog=TestDB" );
conn.Open();
SqlCommand cmd = new SqlCommand("Select UserName, First Name,LastName,Location FROM Users" , conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
//Create object to DataTable
da.Fill(dt); //Fill User Data in DataTable

Difference between DataSet and DataTable in c#

  DataSet DataTable
1

A DataSet is an in-memory representation of a database-like structure which has collection of DataTables.


In Hindi

"Ek dataset ek database-like structure ka ek in-memory representation hai jisme datatables ka collection hota hai"

A DataTable is an in-memory representation of a single database table which has collection of rows and columns


In Hindi

"Ek datatable ek single database table ka ek in-memory representation hai jisme rows and columns ka collection hota hai"

2

It has a collection of datatables.


In Hindi

"Yah datatables ka collection hota hai"

It has a collection of rows and columns.


In Hindi

"Yah rows and columns ka collection hota hai"

3

Enforcing Data Integrity: In DataSet, data integrity is enforced by using the UniqueConstraint and ForeignKeyConstraint objects.


In Hindi

"DataSet me, data integrity UniqueConstraint and ForeignKeyConstraint objects ke using ke dwara enforced hoti hai"

Enforcing Data Integrity: In DataTable, there is no UniqueConstraint and ForeignKeyConstraint objects available.


In Hindi

"DataTable me, koi bhi UniqueConstraint and ForeignKeyConstraint objects available nahi hota hai"

4

Number of rows retrieved at a time: DataSet can fetch multiple TableRows at a time


In Hindi

"DataSet ek baar me multiple TableRows ko fetch kar sakta hai"

Number of rows retrieved at a time: DataTable fetches only one TableRow at a time


In Hindi

"DataTable ek baar me sirf ek hi TableRow ko fetch karta hai"

5

DataSource can be Serialized or Not:
DataSet is serialized DataSource .That is why web services can always returns DataSet as the result but not the DataTables.


In Hindi

"DataSet serialized DataSource hai. Isliye web services as the result hamesa DataSet return karti hai DataTables nahi karti hai"

DataSource can be Serialized or Not:
In DataTable, DataSource cannot be serialized.


In Hindi

"DataTable me, DataSource serialized nahi hota hai"

Difference Between Dataset And DataTable In CSharp
 


DataSet and DataTable

Difference between DataSet and DataTable in c#
 
 

 

 

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments

Walston
16-Aug-2020
Hi to all, it's actually a pleasant for me to go to see this web site, it includes valuable Information.
Beaumont
20-Aug-2020
What's up, after reading this amazing piece of writing i am too happy to share my knowledge here with mates.
Colburn
26-Aug-2020
There is certainly a great deal to learn about this subject. I like all the points you have made.
Fraley
29-Aug-2020
Excellent write-up. I definitely appreciate this site. Stick with it!
Poff
04-Sep-2020
For the reason that the admin of this web page is working, no uncertainty very shortly it will be famous, due to its feature contents.
Roberts
26-Sep-2020
This article will help the internet users for creating new webpage or even a blog from start to end.
Brijesh Kumar
07-Sep-2016
very nice article and useful us.
McBurney
03-Oct-2020
canada drugs online https://canadianpharmacy-usx.com canadian pharmacy online
espn.com/activate
10-Dec-2019
Ask any Search Engine Optimiser, writing a blog post, no matter how good it is, won't bring you any links. Sitting tight after finishing an awesome content is the last thing that you should do, if you want to get high traffic and social shares to the blog post.
Haddon
06-Dec-2019
Good Morning everybody аt ithubcity.ⅽom, we are presently taking on neѡ reviewers who wοuld bе interested iin reviewing our CBD products ѕuch as CBD GUMMIES. If іnterested, please feel free to reach οut to me on https://www.justcbdstore.com
Duigan
15-Jan-2020
Excellent beat ! I wish to apprentice whilst you amend your site, how could i subscribe for a blog web site? The account helped me a acceptable deal. I have been a little bit acquainted of this your broadcast offered bright clear idea
Thomas
01-Dec-2019
Wⲟuld anyⲟne recommend Peaches and Screams UK (https://peachesandscreams.co.uk) fߋr saucy Christmas gifts? Ӏ гeally love tһeir Midnight Fantasy Lace Chemise Тhanks in advance :D
Boose
03-Oct-2020
rx pharmacy online https://rxpharmacyvaed.com/ pharmacy rx world
Mondalmi
05-Sep-2020
This text is worth everyone's attention. When can I find out more?
Riddoch
03-Jul-2020
I am no longer sure the place you're getting your info, however good topic. I needs to spend a while learning more or working out more. Thanks for magnificent information I was in search of this info for my mission.
Mullin
08-Jul-2020
I have to thank you for the efforts you've put in writing this site. I really hope to see the same high-grade content by you in the future as well. In fact, your creative writing abilities has motivated me to get my own website now ;)
Allard
15-Aug-2020
Greetings from Florida! I'm bored at work so I decided to check out your website on my iphone during lunch break. I enjoy the information you present here and can't wait to take a look when I get home. I'm shocked at how fast your blog loaded on my mobile .. I'm not even using WIFI, just 3G .. Anyways, wonderful site!
Salomons
19-Aug-2020
Hi there, There's no doubt that your website could possibly be having web browser compatibility problems. Whenever I look at your site in Safari, it looks fine however, if opening in Internet Explorer, it's got some overlapping issues. I just wanted to provide you with a quick heads up! Apart from that, great blog!
Hong
15-Aug-2020
Wonderful site you have here but I was curious if you knew of any user discussion forums that cover the same topics discussed in this article? I'd really like to be a part of community where I can get comments from other knowledgeable people that share the same interest. If you have any recommendations, please let me know. Many thanks!
Hannam
15-Aug-2020
Thanks very interesting blog!
Goll
26-Aug-2020
Excellent beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog web site? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear idea
Legg
26-Aug-2020
You have made some good points there. I looked on the internet to find out more about the issue and found most people will go along with your views on this web site.
Patton
26-Aug-2020
Thank you for some other informative website. Where else could I get that kind of info written in such a perfect way? I've a mission that I am just now working on, and I've been at the look out for such information.
Lorimer
27-Aug-2020
I've been exploring for a little for any high quality articles or blog posts on this sort of area . Exploring in Yahoo I ultimately stumbled upon this site. Reading this information So i'm satisfied to show that I've an incredibly excellent uncanny feeling I discovered exactly what I needed. I most indisputably will make sure to do not forget this web site and give it a glance on a constant basis.
Bazley
22-Feb-2021
The impactful final results of the programme can only be achieved when all components perform collectively.
Salas
02-Nov-2020
I have to thank you for the efforts you have put in penning this website. I really hope to view the same high-grade blog posts from you later on as well. In fact, your creative writing abilities has encouraged me to get my very own site now ;)
Baker
10-Jan-2021
Why visitors still make use of to read news papers when in this technological world the whole thing is available on net?
Hoke
10-Nov-2020
Heya i am for the primary time here. I found this board and I to find It really helpful & it helped me out a lot. I am hoping to give one thing again and help others such as you helped me.
Truchanas
12-Jan-2021
Pretty nice post. I just stumbled upon your blog and wished to say that I've truly enjoyed browsing your blog posts. In any case I'll be subscribing to your feed and I hope you write again very soon!
Tuckson
23-Jan-2021
Hello to all, how is everything, I think every one is getting more from this site, and your views are pleasant in favor of new people.
Wirth
26-Jan-2021
Wow that was unusual. I just wrote an really long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Regardless, just wanted to say superb blog!
Silverman
27-Jan-2021
These are actually wonderful ideas in regarding blogging. You have touched some nice things here. Any way keep up wrinting.
Silverman
27-Jan-2021
These are actually wonderful ideas in regarding blogging. You have touched some nice things here. Any way keep up wrinting.
Reginald
31-Jan-2021
If you want to obtain much from this post then you have to apply these methods to your won web site.
Vidler
10-Feb-2021
I don't even know how I ended up here, but I thought this post was good. I do not know who you are but definitely you are going to a famous blogger if you aren't already ;) Cheers!
Wittenoom
21-Mar-2021
I like what you guys are up too. Such clever work and coverage! Keep up the superb works guys I've you guys to my own blogroll.
Rumpf
15-Aug-2020
Incredible points. Sound arguments. Keep up the great effort.
Tuggle
11-Aug-2020
Regards for all your efforts that you have put in this. Very interesting info.
Butters
12-Aug-2020
We've reduced pricing on all immunity merchandise to assist our neighborhood.
Servin
05-Sep-2020
Hello, I enjoy reading through your post. I like to write a little comment to support you.
Humffray
14-Aug-2020
I'm pretty pleased to uncover this website. I need to to thank you for your time just for this wonderful read!! I definitely enjoyed every part of it and i also have you book-marked to look at new stuff on your blog.
Herington
14-Aug-2020
I am really loving the theme/design of your web site. Do you ever run into any web browser compatibility issues? A handful of my blog audience have complained about my blog not working correctly in Explorer but looks great in Chrome. Do you have any tips to help fix this issue?
Shanahan
14-Aug-2020
My brother suggested I might like this blog. He was totally right. This post actually made my day. You cann't imagine just how much time I had spent for this information! Thanks!
Eastwood
27-Aug-2020
Hmm is anyone else experiencing problems with the images on this blog loading? I'm trying to find out if its a problem on my end or if it's the blog. Any feedback would be greatly appreciated.
Hollinworth
01-Sep-2020
I simply could not depart your site before suggesting that I actually enjoyed the standard info an individual provide on your guests? Is going to be again frequently in order to check up on new posts
Biscoe
03-Sep-2020
Thanks for ones marvelous posting! I seriously enjoyed reading it, you will be a great author. I will make sure to bookmark your blog and will often come back sometime soon. I want to encourage that you continue your great posts, have a nice holiday weekend!
Morgan
05-Sep-2020
Very energetic post, I liked that bit. Will there be a part 2?
Goodsell
05-Sep-2020
Good day! I know this is kinda off topic however , I'd figured I'd ask. Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa? My website discusses a lot of the same topics as yours and I believe we could greatly benefit from each other. If you happen to be interested feel free to shoot me an e-mail. I look forward to hearing from you! Terrific blog by the way!
Colton
05-Sep-2020
I like the valuable information you provide in your articles. I'll bookmark your blog and check again here frequently. I am quite certain I will learn a lot of new stuff right here! Best of luck for the next!
Skeats
05-Sep-2020
Very great post. I simply stumbled upon your weblog and wished to mention that I've really loved surfing around your blog posts. After all I'll be subscribing on your rss feed and I am hoping you write once more soon!
Sykes
05-Sep-2020
I constantly spent my half an hour to read this web site's articles daily along with a mug of coffee.
Ashley
05-Sep-2020
Good day! Do you know if they make any plugins to assist with Search Engine Optimization? I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good success. If you know of any please share. Kudos!
Hagai
05-Sep-2020
I feel this is one of the so much important info for me. And i'm happy studying your article. However want to statement on some general issues, The web site style is wonderful, the articles is truly nice : D. Just right job, cheers
Torrence
14-Aug-2020
Heya! I'm at work surfing around your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Carry on the excellent work!
Lesina
05-Sep-2020
Wonderful blog! I found it while surfing around on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I've been trying for a while but I never seem to get there! Thanks
Devlin
05-Sep-2020
certainly like your web site but you need to check the spelling on quite a few of your posts. Several of them are rife with spelling issues and I to find it very troublesome to tell the truth nevertheless I will certainly come again again.
Galarza
05-Sep-2020
I’m not that much of a internet reader to be honest but your blogs really nice, keep it up! I'll go ahead and bookmark your website to come back later on. Many thanks
Breinl
27-Aug-2020
I've read some good stuff here. Certainly value bookmarking for revisiting. I surprise how much attempt you put to create this sort of magnificent informative website.
Dilke
05-Sep-2020
Hi there, just wanted to tell you, I enjoyed this post. It was funny. Keep on posting!
Fromm
21-Mar-2021
Hi there I am so grateful I found your blog, I really found you by accident, while I was researching on Google for something else, Regardless I am here now and would just like to say kudos for a incredible post and a all round exciting blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have saved it and also added your RSS feeds, so when I have time I will be back to read much more, Please do keep up the great work.
Gallardo
04-Nov-2021
What a data of un-ambiguity and preserveness of valuable know-how regarding unexpected feelings.
Sulman
09-Apr-2021
Hello there, I found your web site by way of Google even as looking for a similar topic, your website came up, it seems good. I have bookmarked it in my google bookmarks. Hello there, simply turned into aware of your weblog thru Google, and located that it's truly informative. I am gonna be careful for brussels. I'll be grateful if you happen to proceed this in future. Lots of folks shall be benefited out of your writing. Cheers!
Bingham
01-May-2021
I really like what you guys are up too. This kind of clever work and exposure! Keep up the awesome works guys I've included you guys to our blogroll.
Wilsmore
14-May-2021
Someone essentially lend a hand to make significantly articles I would state. That is the first time I frequented your website page and thus far? I amazed with the research you made to make this actual post amazing. Excellent activity!
Pritchard
24-Jun-2021
Excellent, what a web site it is! This weblog gives valuable facts to us, keep it up.
McCrae
03-Jul-2021
If you wish for to improve your knowledge only keep visiting this site and be updated with the newest gossip posted here.
Ranford
01-Jul-2021
I do not even know how I ended up here, but I thought this post was good. I don't know who you are but definitely you're going to a famous blogger if you are not already ;) Cheers!
Colon
14-Aug-2021
Hello, I enjoy reading through your article. I like to write a little comment to support you.
Newman
18-Aug-2021
Hi there, I found your site by way of Google even as looking for a similar subject, your site came up, it seems great. I have bookmarked it in my google bookmarks. Hi there, just became aware of your blog via Google, and found that it's really informative. I am gonna watch out for brussels. I'll be grateful in case you continue this in future. A lot of people can be benefited from your writing. Cheers!
Kavanaugh
31-Aug-2021
Every weekend i used to pay a quick visit this website, because i wish for enjoyment, since this this web site conations actually fastidious funny information too.
Maloney
18-Mar-2021
I am not sure where you are getting your info, but good topic. I needs to spend some time learning much more or understanding more. Thanks for magnificent information I was looking for this info for my mission.
Chuter
14-Jun-2021
Amazing things here. I am very glad to see your article. Thanks so much and I am looking forward to touch you. Will you kindly drop me a e-mail?
Scott
02-Jun-2021
I think this is among the most significant info for me. And i'm glad reading your article. But want to remark on few general things, The site style is perfect, the articles is really excellent : D. Good job, cheers
Porteous
13-Aug-2021
I quite like reading a post that will make people think. Also, thank you for permitting me to comment!

                           
                           

                           

                           

Facebook User: