A Newbie OOP conceptual question

T

Tony Van

I'm slogging my way up the learning curve for VB.net, and I
have a conceptual question regarding classes.

I have a name and address database and I'm writing a
program to display names, phone numbers, that kind of stuff.
Eventually, I'll expand the database into a generic
name/address db to use in other programs to hold clients and
contractors as well as the original Rolodex application.

I constructed a class to handle database access. The
properties of the class are the database fields, and there
are methods to AddNew, Update, Delete and Find a database
entry.

All well and good.

Sometimes however, the user will need to get a number of
entries, for example, when he/she searches on all entries in
a certain state. The result set is put into a list box for
selection of a single entry to view (and perhaps edit).

My questions is: Should this multiple record searching be
done outside the class? Is there anyway to have the class
do this without a lot of overhead?

If I do this outside the class are the OOP police going to
come for me? I'm joking, but I really would like the class
to be reusable over a number of applications.

I don't need code, just a shove in the right direction.

Many thanks.

Tony
 
K

Kevin Spencer

A lot of the answer depends on your requirements. For example, by using a
DataSet with a DataTable, you could simply fill the DataTable from the
underlying Data Store, and then perform searches by creating various
DataViews of the DataTable, and using filters on them. This would remove the
necessity of querying the database each time a search is done. But,
depending on the requirements, and the size of the Data Store, it might not
be the best route to take.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Expect the unaccepted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

OOP Inheritance Question 3
Newbie OOP question... 1
OOP Failed? 6
Looking for asp.net centric OOP courses/classes. 2
OOP or COP? 3
OOP Question 3
OOP Question 2
using events (conceptual) 10

Top