473,387 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Globally Inerit Class in an App

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
2 1137
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: steve | last post by:
Dont’ make my mistake. It is costly. Say you have defined a variable $var in your main script. Now in a function you access it using: global $var; But you want to set it to null inside the...
13
by: Jean-François Doyon | last post by:
Hello, I'm using MetaClasses to create classes. How do I make these new classes "globally" available? I probably just have to assign them to something magic, but I can't seem to figure out...
4
by: Otto Lind | last post by:
The following program shows the problem: #include <stdio.h> namespace x { enum L { One = 1, Two = 2 }; namespace x { enum L { Three = 3, Four = 4 };
2
by: aevans1108 | last post by:
Greetings Please give me a push in the right direction if this the wrong place to ask this question. Why is it that I can get the count of facets for an element restriction if the...
4
by: Cliff Harris | last post by:
Is there a way for me to globally add a javascript block to all pages? I was hoping I could use one of the application events, but I don't seem to have access to the page object to use...
8
by: Dougal Fair | last post by:
I'm writing a VB.NET application, and I have a lot of general-purpose utility functions that need to be available throughout the program (like functions that perform standard date conversions...
7
by: Cheryl Langdon | last post by:
Does anyone know if there is a way to globally turn off ALL control tips in Access 2003 using VBA code? Thanks. --- CL
4
by: Polaris431 | last post by:
I have a web application in ASP.NET that will be used globally. Data is collected on mobile devices running Windows Mobile and sent to the web server where it is stored and can be viewed. Data is...
4
by: Morgan Cheng | last post by:
Days ago, I post a question on how to make SoapHttpClientProtocol instance make new TCP connection for each web service request. Now, I found how. SoapHttpClientProtocol has a protected method...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.