473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 5618
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("ColumnName");
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(dt);

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

************************************************
Think Outside the Box!
************************************************
"Mojtaba Faridzad" <mf*******@hotmail.com> wrote in message
news:ek**************@TK2MSFTNGP10.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.netNoSpamM> wrote
in message news:u3**************@tk2msftngp13.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("ColumnName");
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(dt);

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

************************************************
Think Outside the Box!
************************************************
"Mojtaba Faridzad" <mf*******@hotmail.com> wrote in message
news:ek**************@TK2MSFTNGP10.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*******@hotmail.com> wrote in message
news:uC**************@TK2MSFTNGP12.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.netNoSpamM> wrote in message news:u3**************@tk2msftngp13.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("ColumnName");
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(dt);

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

************************************************
Think Outside the Box!
************************************************
"Mojtaba Faridzad" <mf*******@hotmail.com> wrote in message
news:ek**************@TK2MSFTNGP10.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
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...
2
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...
13
by: Adie | last post by:
Hi, is this not possible? public DataSet getDimensions() { } public SqlDataReader getDimensions() { }
1
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...
3
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
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...
22
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...
7
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...
3
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.