473,664 Members | 2,773 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How DataSet works?

Hi,

I am a newbie! I am wondering how DataSet keeps the data. I am using MySQL
as database engine. when I use "Fill" method to set a table in DataSet, does
C# retreive all data (base on Select statement) to the local computer's
memory? if we retreive 100,000 records, does it take a while to load them?

another question that I am not sure about it. can we create a table in
DataSet without relation to MySQL database? I'd like to create a temporary
table on a local computer's memory (not on the server). is that possible?
how?

thanks in advance
Nov 16 '05 #1
3 5636
The entire set is loaded into memory on the machine using the DataSet. It is
pulled as XML. For huge recordsets, you may notice it taking awhile. I
cannot comment on 100,000 records, as I do not know the column lengths. It
could be slow.

The ADO.NET model allows you to create a new Table programatically .

1. Create a DataTable object

DataTable dt = new DataTable();

2. Create columns for the data table

DataColumn dc = new DataColumn("Col umnName");
dt.Columns.Add( dc);

3. Create a new row and fill each column

DataRow dr = new DataRow();
dr["ColumnName "] = "some value";
dt.Rows.Add(dr) ;

4. Repeat step three until you have all rows filled

dr = new DataRow();
dr["ColumnName "] = "some other value";
dt.Rows.Add(dr) ;

5. Add DataTable to DataSet

ds.Tables.Add(d t);

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***
"Mojtaba Faridzad" <mf*******@hotm ail.com> wrote in message
news:ek******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I am a newbie! I am wondering how DataSet keeps the data. I am using MySQL
as database engine. when I use "Fill" method to set a table in DataSet, does C# retreive all data (base on Select statement) to the local computer's
memory? if we retreive 100,000 records, does it take a while to load them?
another question that I am not sure about it. can we create a table in
DataSet without relation to MySQL database? I'd like to create a temporary table on a local computer's memory (not on the server). is that possible?
how?

thanks in advance

Nov 16 '05 #2
thanks for your answer!

have you ever needed to show more than 100,000 records (one of my table has
450,000 records) in a DataGrid? how did you deal with it? I had this
problem before and I had to break the data to each page. when user clicks on
next page, I retreive the next page from the server. I am wondering there is
a better method in C# or not.

about your code, i typed it and it worked fine (with minor changes). after
using the temporary table, should we use Clear method to get rid of the
table? or like creating a connection, we can add the table in using( ) block
? or we have to call Dispose?

thanks again

"Cowboy (Gregory A. Beamer) [MVP]" <No************ @comcast.netNoS pamM> wrote
in message news:u3******** ******@tk2msftn gp13.phx.gbl...
The entire set is loaded into memory on the machine using the DataSet. It
is
pulled as XML. For huge recordsets, you may notice it taking awhile. I
cannot comment on 100,000 records, as I do not know the column lengths. It
could be slow.

The ADO.NET model allows you to create a new Table programatically .

1. Create a DataTable object

DataTable dt = new DataTable();

2. Create columns for the data table

DataColumn dc = new DataColumn("Col umnName");
dt.Columns.Add( dc);

3. Create a new row and fill each column

DataRow dr = new DataRow();
dr["ColumnName "] = "some value";
dt.Rows.Add(dr) ;

4. Repeat step three until you have all rows filled

dr = new DataRow();
dr["ColumnName "] = "some other value";
dt.Rows.Add(dr) ;

5. Add DataTable to DataSet

ds.Tables.Add(d t);

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***
"Mojtaba Faridzad" <mf*******@hotm ail.com> wrote in message
news:ek******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I am a newbie! I am wondering how DataSet keeps the data. I am using
MySQL
as database engine. when I use "Fill" method to set a table in DataSet,

does
C# retreive all data (base on Select statement) to the local computer's
memory? if we retreive 100,000 records, does it take a while to load

them?

another question that I am not sure about it. can we create a table in
DataSet without relation to MySQL database? I'd like to create a

temporary
table on a local computer's memory (not on the server). is that possible?
how?

thanks in advance


Nov 16 '05 #3
With ASP.NET, you can use the paging features. I am not as familiar with the
Windows version of the DataGrid, howver.

I have seen some articles on faking paging by linking primary keys from the
last record and the first record, if you need to roll your own.

If you are creating a table that could potentially exist, consider checking
the DataSet to see if it is there and clearing it. You can also add rows to
a table that already exists, if you are inclined. This can be sent back to
the database through an Update() on the DataAdapter you created the DataSet
with.

Hope this helps.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***
"Mojtaba Faridzad" <mf*******@hotm ail.com> wrote in message
news:uC******** ******@TK2MSFTN GP12.phx.gbl...
thanks for your answer!

have you ever needed to show more than 100,000 records (one of my table has 450,000 records) in a DataGrid? how did you deal with it? I had this
problem before and I had to break the data to each page. when user clicks on next page, I retreive the next page from the server. I am wondering there is a better method in C# or not.

about your code, i typed it and it worked fine (with minor changes). after
using the temporary table, should we use Clear method to get rid of the
table? or like creating a connection, we can add the table in using( ) block ? or we have to call Dispose?

thanks again

"Cowboy (Gregory A. Beamer) [MVP]" <No************ @comcast.netNoS pamM> wrote in message news:u3******** ******@tk2msftn gp13.phx.gbl...
The entire set is loaded into memory on the machine using the DataSet. It is
pulled as XML. For huge recordsets, you may notice it taking awhile. I
cannot comment on 100,000 records, as I do not know the column lengths. It could be slow.

The ADO.NET model allows you to create a new Table programatically .

1. Create a DataTable object

DataTable dt = new DataTable();

2. Create columns for the data table

DataColumn dc = new DataColumn("Col umnName");
dt.Columns.Add( dc);

3. Create a new row and fill each column

DataRow dr = new DataRow();
dr["ColumnName "] = "some value";
dt.Rows.Add(dr) ;

4. Repeat step three until you have all rows filled

dr = new DataRow();
dr["ColumnName "] = "some other value";
dt.Rows.Add(dr) ;

5. Add DataTable to DataSet

ds.Tables.Add(d t);

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***
"Mojtaba Faridzad" <mf*******@hotm ail.com> wrote in message
news:ek******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I am a newbie! I am wondering how DataSet keeps the data. I am using
MySQL
as database engine. when I use "Fill" method to set a table in DataSet,

does
C# retreive all data (base on Select statement) to the local computer's
memory? if we retreive 100,000 records, does it take a while to load

them?

another question that I am not sure about it. can we create a table in
DataSet without relation to MySQL database? I'd like to create a

temporary
table on a local computer's memory (not on the server). is that possible? how?

thanks in advance



Nov 16 '05 #4

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

Similar topics

6
2247
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or
2
2015
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or
13
2486
by: Adie | last post by:
Hi, is this not possible? public DataSet getDimensions() { } public SqlDataReader getDimensions() { }
1
1721
by: Mike Hnatt | last post by:
I'm baffled. My data store (database) is not updating with a refreshed dataset. Here's what is going on: 1) Create a dataset from a table in a database. 2) Create a copy of this dataset and maniuplate (update some records) 3) Now, merge this copied dataset back into the original dataset (using the Merge method) 4) Now display this original dataset in a datagrid to prove the data has
3
1926
by: jcrouse | last post by:
I have the following code that creates a couple of XML files: Dim dt1 As New DataTable("P1JoyUp") If H = True Then Dim dsH As New DataSet("HCPViewer") dsH.Tables.Add(dt1)
12
1993
by: Graham Blandford | last post by:
Hi all, Would someone be able to tell me the most 'graceful' way of removing unwanted rows from a dataset based on a condition prior to update? OR, resetting the rows all to unchanged after they are initally added to the recordset. I create a dataset, which begins empty after the initial .Fill. Then I create several rows with some default information, leaving one
22
25575
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet = ws.VerifySku(cartSet)
7
3355
by: Jean Christophe Avard | last post by:
Hi! I have a dataset that retreive all the item information from the database. I need to be able to edit them, in the dataset and in the database. I have this code, could anyone tell me if I'm in the good way, cause I build that code from a book example, but nothing works. I HAVE THIS CODE TO SAVE THE CHANGE OF THE DATASET dstPlant.Tables("plant").Rows(intEditRow)("latin_name") = "KLHJJKJKJKHHHHHH"
3
2750
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong typed properties from my original dataset Anyone that can point me to an example of how to sort my dataset and maintain the use of my typed properties would be greatly appreciated Thank, Freeon
5
1852
by: Franck | last post by:
how come unchanged always true even if data changed This code come from my saving button: ============================================ DataSet ds1 = new DataSet(); DataSet ds2 = new DataSet(); DataSet ds3 = new DataSet(); //Static Dataset which contain values when my form load
0
8438
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2765
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 we have to send another system

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.