473,698 Members | 2,346 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2085

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.space s.live.com/Blog/cns!A68482B9628 A842A!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********@dis cussions.micros oft.comwrote in message
news:92******** *************** ***********@mic rosoft.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********@dis cussions.micros oft.comwrote in message
news:92******** *************** ***********@mic rosoft.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**@markNOSPA Mrae.netwrote in message
news:uK******** ******@TK2MSFTN GP03.phx.gbl...
"Aleks Kleyn" <Al********@dis cussions.micros oft.comwrote in message
news:92******** *************** ***********@mic rosoft.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*********@Ma ilAps.orgwrote in message
news:1E******** *************** ***********@mic rosoft.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*********@Ma ilAps.orgwrote in message
news:1E******** *************** ***********@mic rosoft.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********@dis cussions.micros oft.comwrote in message
news:56******** *************** ***********@mic rosoft.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**@markNOSPA Mrae.netwrote in message
news:OG******** ******@TK2MSFTN GP04.phx.gbl...
"Aleks Kleyn" <Al********@dis cussions.micros oft.comwrote tin message
news:56******** *************** ***********@mic rosoft.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
2618
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, then written to the database... or at least that's what's supposed to be happening. Unfortunately, I've discovered that while it appears that when I create a new record/row I'm successfully updating the Access database, once the Update is...
3
4601
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. I'm getting some strange results depending the input XML file I use. I was wondering if somebody could help me understand what is going on or point me to a good reference. The code for my program looks like this:
35
2121
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; namespace TestNamespace {
15
2243
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
2018
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 dataset dsSearch CODE ON http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3994&lngWId=10 using SQL connection get data from view on sql server, add to dataset dsSearch
5
7425
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 navigating through the data. I can get the data into a datagrid without any problems, but I want the data to show up in textboxes and use some sort of move next, move previous, move last, etc (like in VB6) command to navigate the data (using...
3
2519
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 others. One of the custom format is as follows: dsmessages_dt.Columns.Add("Image", GetType(Image)) I had a problem of when I used a checkbox in the grid that was bound to the datatable that it would not update my dataset. So I created another...
10
6535
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 have one querie that grabs all of the id's I need for the other 4 queries, but I am not sure how to get them into a DataTable or DataSet, or if that is the best way to do this. Seperately the queries all work with no problems.
3
1972
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 dataset?
3
2838
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 dataset to data in a second dataset, using a common key. I will first describe the problem in words and then I will show my code, which has most of the solution done already. I have built an ASP.NET that queries an Index Server and returns a...
0
8676
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
9164
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
8870
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
7734
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...
1
6524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
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();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.