Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to store a datatable temporarily

Reply
Thread Tools

How to store a datatable temporarily

 
 
Sobin Thomas
Guest
Posts: n/a
 
      06-02-2008
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


 
Reply With Quote
 
 
 
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      06-02-2008
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


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


 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      06-02-2008
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" <(E-Mail Removed)> wrote in message
news:e2Pzd%(E-Mail Removed)...
> 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
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Sort a datatable and create a new datatable Fredrik Rodin ASP .Net 3 09-28-2007 07:28 AM
Create a Datatable from a SQL datatable column shema? jg ASP .Net 1 08-17-2004 09:43 PM
Casting DataTable to class inherit from DataTable =?Utf-8?B?Qmx1ZWZsb3dlcg==?= ASP .Net 0 04-02-2004 05:41 AM
Adding DataTable Rows To another DataTable J. Babe ASP .Net 1 08-15-2003 05:04 PM



Advertisments