Re: Global datasets
- From: "Dan Bass" <na>
- Date: Tue, 14 Nov 2006 13:46:00 -0000
David,
From what I can tell, you're confusing "Global" with "Cached" or "Session"objects... Are you trying to building a dataset object once, then have
subsequent page refreshes use the cached object?
I punched "ASP.Net session objects" into google and got this link straight
away which goes into the details a bit more...
http://www.aspfree.com/c/a/ASP.NET/Application-and-Session-Objects-in-ASP.NET/
If this is not what you want to do, or you want more help on it, let me
know.
Thanks.
Dan.
"David Colliver" <DavidColliver@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:61FEC230-CF39-4F9D-AFD5-3985F9E1E573@xxxxxxxxxxxxxxxx
Hi,
using c#, 1.1
I know that we are not supposed to use global variables etc. in c#
I am having a problem, but not sure how to resolve. I did have another
post
here, but may have over confused things, so I will start afresh.
An example of what I want to do...
namespace MyDataSet
{
public class MyDSClass
{
public DataSet MyDS
{
// Do the dataset stuff.
return MyData;
}
}
}
I want to be able to instantiate the above code only once per page load
and
return a dataset.
in my page...
using MyDataSet;
namespace MyPage
{
public class MyPageClass : System.Web.UI.Page
{
private void Page_Load(object sender, eventargs e)
{
// I need to open the dataset created in the MyDSClass, without
re-instantiating it. If it needs to re-instantiate, then only do it once.
MyDataGrid.DataSource = MyDS;
MyDataGrid.DataBind();
}
}
}
So, the above code wants to use the dataset, but not have to create it. If
it has to be created, then I need to do it, but then other controls that
use
it should not have to re-create it once it has re-created.
using MyDataSet;
namespace MyUC
{
public class MyPageClass : System.Web.UI.UserControl
{
private void Page_Load(object sender, eventargs e)
{
// I need to open the dataset created in the MyDSClass, without
re-instantiating it. If it needs to re-instantiate, then only do it once.
MyUCDataGrid.DataSource = MyDS;
MyUCDataGrid.DataBind();
}
}
}
What I am trying to avoid is to have to go to the database each time MyDS
is
needed. When the page is run, I only want to have to go to the database
once,
to build my dataset. I want to be able to use that dataset in the page, or
control that the page hosts.
How can I make my dataset "global" and how do I then view the "global"
dataset in each control without creating a new dataset each time it is
required?
All help is appreciated. Please do ask me questions if needed so that I
can
get this resolved.
Regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Portal franchises available
.
- Follow-Ups:
- Re: Global datasets
- From: David Colliver
- Re: Global datasets
- References:
- Global datasets
- From: David Colliver
- Global datasets
- Prev by Date: Re: ATLAS / AJAX newsgroup?
- Next by Date: Re: ASP.NET SMTP mail never received
- Previous by thread: Global datasets
- Next by thread: Re: Global datasets
- Index(es):
Relevant Pages
|
Loading