Home > Archive > ASP > October 2006 > Global Objects inside User Controls?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Global Objects inside User Controls?
|
|
| Greg Stevens 2006-10-30, 9:55 pm |
| [note: I am relatively new to ASP.NET, so I'm very possibly doing something
stupid or overlooking something obvious. Please be forgiving, and walk me
through your answer as much as possible. Much appreciated.]
Here is the situation. I'm developing an application where:
I have defined a class (DBClass) to provide an abstraction layer for
interacting with a database. When an instance of the class is created, it
creates a connection to the database. My initial plan was that, at the very
top of each page I would:
1) include the DBClass class file, so the page knows about the class
2) create an instance of DBClass, which I call DB.
My thought was, once the DB instance was created, I would be able to use it
anywhere on the page.
However, on the page I am also making use of a "user control". This user
control has to have access to the database. When I simply reference DB in
the control file, the compiler complains, because I have not created the
instance DB in the control file.
I'm sure I'm probably just approaching this the wrong way or leaving out
something obvious.... can anyone help?
---G
| |
| Evertjan. 2006-10-30, 9:55 pm |
| =?Utf-8?B?R3JlZyBTdGV2ZW5z?= wrote on 30 okt 2006 in
microsoft.public.inetserver.asp.general:
> [note: I am relatively new to ASP.NET, so I'm very possibly doing
> something
>
This NG is classic ASP.
Please try a dotnet group.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
| |
| Greg Stevens 2006-10-30, 9:55 pm |
| My apologies.
"Evertjan." wrote:
> =?Utf-8?B?R3JlZyBTdGV2ZW5z?= wrote on 30 okt 2006 in
> microsoft.public.inetserver.asp.general:
>
>
> This NG is classic ASP.
>
> Please try a dotnet group.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
>
|
|
|
|
|