dataset and more complex relational data

S

stormogulen

Hi!

I'm hoping someone can help me come up with a 'best possible solution'
for the following problem:

I'm trying to design an addressbook, i.e a storage for adresses. I
would like my adresses to have a random number of fields, all of which
are strings. Futhermore every address can belong to zero or more
categories (ie. friend, family etc.)

Now, I've designed some tables in a relational database to store these
data:

create table addressId (
id counter primary key
);

create table addresses(
id int,
fieldname string,
fieldvalue string);

alter table addresses add constraint foregin key (id) references
addressId(id);

--- so an adress is really a list of fields.

create table kategories(
id counter primary key,
name string
);

create table adrkat(
adr_id int,
kat_id int
);

I think you get the idea, right? An address is a list of fields, and
an address has a many-to-many relationsship with some categories.

Anyway, the question: How can I best organize my adresses in csharp,
using DataSets, DataAdapters and whatnot?

First I thought of letting an address be a hashtable, but then again I
could also incapsulate a dataset containing one or all of the above
tables in an an address object.

So I guess the question is:
- How do I incapsulate several tables in one dataset. Is that the way
to do it?
- How do I manage insertions/deletions - is that ready 'out of the
box' with datasets?

Phuu..maybe a too complex question, but I'm hoping you can give me
some ideas or point me to something simillar made before?

Regards,
Bjarne
 
R

RFS

Hi bjarne,
The answer depends on how you store the data. If the Data is store in a db
of in a XML. I would use a dataset or the like to link to the datastore I
would then create a class for every "noun" in your specification. That is
one for every address one for every person and so on. It's much easier to do
stuff with your records that way, and if you tie up the properties to the
dataset (or what ever u used) updating the datastore would be really easy.
If you take a look at dk.edb.programmering.dotnet under the thread smart...?
you can see a similiar discussion (it's in danish so only useful if you
understand my mother tongue)
 

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

Top