By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,350 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,350 IT Pros & Developers. It's quick & easy.

Globally Inerit Class in an App

P: n/a
I have a database class that I have created that handles connecting and
disconnecting and error reporting and all of that so I don't have to do
it in my actual pages. I have a base page that all of my pages inherit
that declares the database class object so on any child page I can say:

MyBase.oDatabase.GetRecord("Select blah from blah where blah")

to get a record.

Is this the best way to do this?
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"best" is subjective.
Is it a perfectly viable way, yes, especially if your pages are all using
it. If they aren't then it's unecessary overhead.
We use two "base" pages, one with the db, and other, items that are only
used on our maintenance screens and one that's got a few less things in it
for other pages to inherit from. Both of these two pages inherit from one
"master" though so there is littel repetative work.

Just a thought.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Brad" <br**@seesigifthere.com> wrote in message
news:MPG.1b98ff1612286d199896b7@news...
I have a database class that I have created that handles connecting and
disconnecting and error reporting and all of that so I don't have to do
it in my actual pages. I have a base page that all of my pages inherit
that declares the database class object so on any child page I can say:

MyBase.oDatabase.GetRecord("Select blah from blah where blah")

to get a record.

Is this the best way to do this?

Nov 18 '05 #2

P: n/a
It would be better if your database class used static methods. That way you
don't have to bother instantiating a class that may or may not be used in
every page. Generally speaking, most database operations are not related to
one another, which makes using static methods a good practice with regards
to database operations.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Brad" <br**@seesigifthere.com> wrote in message
news:MPG.1b98ff1612286d199896b7@news...
I have a database class that I have created that handles connecting and
disconnecting and error reporting and all of that so I don't have to do
it in my actual pages. I have a base page that all of my pages inherit
that declares the database class object so on any child page I can say:

MyBase.oDatabase.GetRecord("Select blah from blah where blah")

to get a record.

Is this the best way to do this?

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.