473,387 Members | 1,504 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,387 software developers and data experts.

Dataset and datatable

I use in my asp.net code dataset and populate datatable using dataadapter.

The problem is that my code demand huge amount of memory and I am looking
for way reduce this demand.

At this time I keep links to dataset, dataadapter and datatable in session.

As I understand datatable is class and specific datatable does not belong
directly to dataset and using the same dataadapter I can populate two
datatables different way from the same real table. Does it mean that if I
move dataset to application level and limit scope of dataadapter and
datatable to specific page I will save in memory. Or better to keep dataset
on level of session collection?

Aug 6 '07 #1
7 2058

DataSets are very "cure all" objects. They allow binding (for one thing) in
a winforms application, and thus have some overhead as far as implementing
the IEditableObject interface.

So you're saying "why is he telling me about a winforms app? I'm in the
asp.net newsgroup".

Because you pay that price for using a DataSet (or strongly typed dataset).
Even in an asp.net application.
You can do a google search for
IDataReader DataSet
and you'll find some references about that.
You have to ask yourself a few question. Do I need the entire collections
of objects in memory for anything?
Am I just binding data to some output (repeater, gridview, etc)?

Here is one option for reducing overhead.
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry

Use an IDataReader to put your data_values into objects, and then those
objects into collections.
You can also (usually) bind a repeater control (one example that is) to an
IDataReader, although personally I don't like having IDataReaders floating
around in the presentation layer.

It this a "quickie application"? Or something that's going to be around for
a while.

Keep in mind, that Rapid Development doesn't always mean (or perhaps seldom
means) ... "good development".

"Aleks Kleyn" <Al********@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
>I use in my asp.net code dataset and populate datatable using dataadapter.

The problem is that my code demand huge amount of memory and I am looking
for way reduce this demand.

At this time I keep links to dataset, dataadapter and datatable in
session.

As I understand datatable is class and specific datatable does not belong
directly to dataset and using the same dataadapter I can populate two
datatables different way from the same real table. Does it mean that if I
move dataset to application level and limit scope of dataadapter and
datatable to specific page I will save in memory. Or better to keep
dataset
on level of session collection?

Aug 6 '07 #2
"Aleks Kleyn" <Al********@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
At this time I keep links to dataset, dataadapter and datatable in
session.
Why?

Unless the data is relatively small, and needs to be fetched *once only* per
session (e.g. maybe some metadata about the currently logged-on user), it is
(nearly) always preferable to fetch data as and when it's needed.

As a general rule, the more "room" you can give your ASP.NET app, the better
it will perform. ADO.NET uses something called connection pooling which
means that many small database reads will always perform much better then a
few large database reads.

Overuse of session is one sure way of cripping your ASP.NET app - how much
data are you actually storing in session...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 6 '07 #3
This is asp.net application. For instance. I read large amount of data to
present in datagrid. I cannot show all data on the same page, it will take a
work to scroll down a screen. I prefered datatable because it is ready
collection, I have read data from database and connection is closed. However
when I call on datagrid next page I reload page. So I have choice. I
populate datatable one time more. Or I save it in session collection.
However I discovered, when I choose second choice and 10-15 people use this
web page, the amount of memory for aspnet.exe grows 2kb each 5-10 sec. This
continues until 100% cpu time is dedicated to memory paging. This clearly
means that I need to find better answer.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uK**************@TK2MSFTNGP03.phx.gbl...
"Aleks Kleyn" <Al********@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
>At this time I keep links to dataset, dataadapter and datatable in
session.

Why?

Unless the data is relatively small, and needs to be fetched *once only*
per session (e.g. maybe some metadata about the currently logged-on user),
it is (nearly) always preferable to fetch data as and when it's needed.

As a general rule, the more "room" you can give your ASP.NET app, the
better it will perform. ADO.NET uses something called connection pooling
which means that many small database reads will always perform much better
then a few large database reads.

Overuse of session is one sure way of cripping your ASP.NET app - how much
data are you actually storing in session...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Aug 7 '07 #4
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:1E**********************************@microsof t.com...
This is asp.net application. For instance. I read large amount of data to
present in datagrid. I cannot show all data on the same page, it will take
a
work to scroll down a screen. I prefered datatable because it is ready
collection, I have read data from database and connection is closed.
However
when I call on datagrid next page I reload page. So I have choice. I
populate datatable one time more. Or I save it in session collection.
However I discovered, when I choose second choice and 10-15 people use
this
web page, the amount of memory for aspnet.exe grows 2kb each 5-10 sec.
This
continues until 100% cpu time is dedicated to memory paging. This clearly
means that I need to find better answer.
Correct, and the better answer is not to persist the data in session.

Also, is there any reason that you're using DataGrid instead of GridView...?
Are you still using ASP.NET v1.1...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 7 '07 #5
No, it is gridview. But it is hard to keep all names in memory and I
sometimes use old names. I do not think it is possible to use dataset in asp
1.0. I understand your point. However one question more. Suppose I expect to
use data from selected row. During the time when user loaded page and clicked
link on it the other user was able to add new records. This means that to
find selected record is better bind dataview to collection.

"Mark Rae [MVP]" wrote:
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:1E**********************************@microsof t.com...
This is asp.net application. For instance. I read large amount of data to
present in datagrid. I cannot show all data on the same page, it will take
a
work to scroll down a screen. I prefered datatable because it is ready
collection, I have read data from database and connection is closed.
However
when I call on datagrid next page I reload page. So I have choice. I
populate datatable one time more. Or I save it in session collection.
However I discovered, when I choose second choice and 10-15 people use
this
web page, the amount of memory for aspnet.exe grows 2kb each 5-10 sec.
This
continues until 100% cpu time is dedicated to memory paging. This clearly
means that I need to find better answer.

Correct, and the better answer is not to persist the data in session.

Also, is there any reason that you're using DataGrid instead of GridView...?
Are you still using ASP.NET v1.1...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 7 '07 #6
"Aleks Kleyn" <Al********@discussions.microsoft.comwrote in message
news:56**********************************@microsof t.com...
No, it is gridview. But it is hard to keep all names in memory and I
sometimes use old names.
I can understand that. However, it's worth trying to use the correct
terminology when posting here because it really helps people to find a
solution for you...
I do not think it is possible to use dataset in asp 1.0.
It was / is. DataSets and DataReaders have existed since the very first
release.
However one question more. Suppose I expect to
use data from selected row. During the time when user loaded page and
clicked
link on it the other user was able to add new records. This means that to
find selected record is better bind dataview to collection.
I apologise, but I don't know what you mean - can you please explain a bit
further...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 7 '07 #7
In the most cases user reads information from the screen or using links he
can go to other page. At time of databinding I can put into link valuable
data, so next page knows what to do. However gridview has oportunity to use
edit or delete buttons. I need to provide code for appropriate events. I did
not see oportunity to get data from selected row. After some research I
found that I can get row and page number and these values together give me
ability to find in binding collection appropriate data.
If bind directly to database then next time I need to use the same query,
but it cannot waranty that information did not change. In this case I need
to bind to collection. Probably this collection should be saved in session,
I do not see other solution. Or is better to create my own link?
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OG**************@TK2MSFTNGP04.phx.gbl...
"Aleks Kleyn" <Al********@discussions.microsoft.comwrote tin message
news:56**********************************@microsof t.com...
>No, it is gridview. But it is hard to keep all names in memory and I
sometimes use old names.

I can understand that. However, it's worth trying to use the correct
terminology when posting here because it really helps people to find a
solution for you...
>I do not think it is possible to use dataset in asp 1.0.

It was / is. DataSets and DataReaders have existed since the very first
release.
>However one question more. Suppose I expect to
use data from selected row. During the time when user loaded page and
clicked
link on it the other user was able to add new records. This means that to
find selected record is better bind dataview to collection.

I apologise, but I don't know what you mean - can you please explain a bit
further...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Aug 8 '07 #8

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

Similar topics

4
by: Frnak McKenney | last post by:
I'm using an in-core DataSet as an image of my application's 'database' (a multi-table Access97 mdb file). Updates are made to the DataTables within the DataSet via forms with bound TextBoxes,...
3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
35
by: MuZZy | last post by:
Hi All, I got a issue here and hope someone can help me: Let's consider this code: // =================== CODE START ================================= using System; using System.Data; ...
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
1
by: cindy | last post by:
Get data into datatable, add to dataset dsSearch " Get data into datatable, add to dataset dsSearch Using In-Memory SQL Engine join the tables and select the filenames from the join, add to...
5
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is...
3
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
3
by: Tom | last post by:
I have a dataTable being returned from my datalayet, I need to convert it to a dataSet so I can do some data manipulation to it prior to populating my datagrid. How can I convert the datatable to a...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.