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

dataset and more complex relational data

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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)
"stormogulen" <sk********@yahoo.dk> skrev i en meddelelse
news:27**************************@posting.google.c om...
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

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.