473,400 Members | 2,145 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,400 software developers and data experts.

How to store a datatable temporarily

Hi All.......
I am a beginner in asp.net.I need your help.I have a gridview control in my
Default.aspx page.I use data adapter to fill a datatable and then I set the
datasource of the gridview as the datatable.The datatable obtained is a
large one.I want this table to be in memory(I dont know how to),as I have to
use the same datatable for enabling paging in gridview.
In short,my problem is ,I need to store the datatable (which is filled by
the adapetr) somewhere temporarily for further use.How can I accomplish
this?
Hope You'll surely have the solution
Regards
Jun 27 '08 #1
2 4734
Hello Sobin,

First, if you get everything from DB to DataSet/DataTable in will be stored
in memory.
Second, your should not extract everything from DB to you dataTables, because
it hinders the performance
Third, read there http://msdn.microsoft.com/en-us/library/aa479347.aspx how
to implement paging without extracting all data from database

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
STHi All.......
STI am a beginner in asp.net.I need your help.I have a gridview
STcontrol in my
STDefault.aspx page.I use data adapter to fill a datatable and then I
STset the
STdatasource of the gridview as the datatable.The datatable obtained
STis a
STlarge one.I want this table to be in memory(I dont know how to),as I
SThave to
STuse the same datatable for enabling paging in gridview.
STIn short,my problem is ,I need to store the datatable (which is
STfilled by
STthe adapetr) somewhere temporarily for further use.How can I
STaccomplish
STthis?
STHope You'll surely have the solution
STRegards
Jun 27 '08 #2
ASP.NET provides a few methods of storing data:

ViewState - ie, in the page. Not good for a large amount of data
Cache - Application caching
Session - Per user caching

If you are paging small amounts of data, you can either pull it each trip or
cache in ViewState. Once you start getting more data, you will want to use
Cache or Session. Session is useful if the user is getting data you are
unlikely to pull for other users. If they are examining the same data sets,
you are better to use Cache.

A bit of info:

Caching:
http://www.eggheadcafe.com/articles/20060407.asp
Go down to caching application data for a code sample

More specific Caching implementation
Part I http://geekswithblogs.net/ranganh/ar.../28/64260.aspx
Part II http://geekswithblogs.net/ranganh/ar.../28/64300.aspx
ViewState - more an intro to how it works
http://msdn.microsoft.com/en-us/library/ms972976.aspx

Session - also general
http://msdn.microsoft.com/en-us/library/ms972429.aspx

In general, you load the data in one of two places:

1. Page_Load in a block where IsPostBack is false
2. After a form submit to pull data

Either way, you isolate this so this code is not run on every hit to the
page. If not, your paging will never work.

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

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"Sobin Thomas" <so***@securesonic.comwrote in message
news:e2****************@TK2MSFTNGP05.phx.gbl...
Hi All.......
I am a beginner in asp.net.I need your help.I have a gridview control in
my Default.aspx page.I use data adapter to fill a datatable and then I set
the datasource of the gridview as the datatable.The datatable obtained is
a large one.I want this table to be in memory(I dont know how to),as I
have to use the same datatable for enabling paging in gridview.
In short,my problem is ,I need to store the datatable (which is filled by
the adapetr) somewhere temporarily for further use.How can I accomplish
this?
Hope You'll surely have the solution
Regards

Jun 27 '08 #3

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

Similar topics

1
by: Nukeation | last post by:
My app has to temporarily use the clipboard - and while doing so, it would delete any existing data which the user has copied (possibly from other applications). What I want to do is temporarily...
0
by: Stephan Steiner | last post by:
Hi I'm trying to temporarily suspend a databinding between a DataTable and a DataGrid. I create a CurrencyManager based on this.BindingContext and then call SuspendBinding() on the...
9
by: VMI | last post by:
I have two tables and I want to compare these two tables with a query( ie. "select * from A where B.key = A.key") and the result will be stored in a 3rd table (table C). is this possible? If...
11
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a...
4
by: Maileen | last post by:
Hi, I would like to do something like in C++. I would like to store several strings, integer,... in something which should be like a vector, or list. ex : "line1","test",5 "line2","good",91...
1
by: VB Programmer | last post by:
I have a SqlDataSource I setup on an ASP.NET 2.0 webform. I setup the SELECT statement and it has 1 parameter, @ProductId. How do I, using VB.NET, store the results of that SELECT statement...
0
by: B.N.Prabhu | last post by:
Hi, I have a DataTable with several rows. Its having 20 Columns. when i click the Insert button then i have to check the Database Rows. Whether these new rows are already available in the...
0
by: seep | last post by:
salam to everyone.. as a new bee in .net i m finding lot of difficulty. i want to get all records of a table from database via store procedure.but spending many days i dont know how can i do...
1
by: Scott | last post by:
In my web app I'm creating a datatable to show my out in a grid. I have a row that has totals within my datatable. How can I store that total to use in another section of code? my datatable...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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,...
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...
0
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,...
0
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...

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.