Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 5th, 2003, 02:07 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,346
Thanks: 0
Thanked 5 Times in 5 Posts
Default DataSet Scope

The problem I am having is that if I try to access my dataset outside of the event where it was filled, it is empty. I added the dataset to the page using the IDE, so I thought once it was filled it was public, this does not seem to be the case. Why, what is it's scope?

In order to try to get around calling the SQL again, I placed the dataset into a session variable. I tried to set the datasource of a data grid using it. dg1.datasource = Session("var"). It did not like this. So, I tried to convert the session to a dataset using CType, it does not like that either.

How can I make my dataset global so I do not have to keep hitting the database? I just want to fille the ds once and access it from anywhere in the page.

Thanks!!

Jim



Reply With Quote
  #2 (permalink)  
Old December 5th, 2003, 02:52 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,413
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you add the dataset with the IDE, it *should* be accessible anywhere in the page class. It should be declared as a protected member of the class. It won't be Public, but Protected. Either way, you should be able to see it.

Check the code, in the "Web Form Designer Generated Code" code region. You should see the dataset object declared in there.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old December 5th, 2003, 02:56 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,346
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Yes it is there... That's why I am confused by this behavior

Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scope of Objects Handman BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8 12 October 20th, 2008 11:06 AM
Scope Issue iceman90289 C# 2005 8 April 5th, 2008 04:41 PM
what is the scope of PHP raaj Beginning PHP 1 February 13th, 2007 12:51 AM
the scope of variable ccj_999 C++ Programming 9 October 26th, 2006 11:35 AM



All times are GMT -4. The time now is 05:31 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.