Complex relational database
-
Hello, I have made a database - SQL Server 2000 - to handle some stuff e.g. contacts, orders, etc. I tried to normalize the database the best that I could and this lead to a lot of tables. For example since the contacts are worldwide, there are 3 tables that each one, hierarchically store country, province, county. Finally in the table where each contact is contained i just store the ID of the county, and the province and stare would be retrived through the realationships. Ok, this is just an example, the thing is much more hierarchical and normalized. I would like to know how can I practically retrive, use, and update data from this database using ADO.NET? I mean, I am a bit confused. Is there a simple way or is it going to be a mess all do be done from zero? Thanks for any help. Edoardo
-
Hello, I have made a database - SQL Server 2000 - to handle some stuff e.g. contacts, orders, etc. I tried to normalize the database the best that I could and this lead to a lot of tables. For example since the contacts are worldwide, there are 3 tables that each one, hierarchically store country, province, county. Finally in the table where each contact is contained i just store the ID of the county, and the province and stare would be retrived through the realationships. Ok, this is just an example, the thing is much more hierarchical and normalized. I would like to know how can I practically retrive, use, and update data from this database using ADO.NET? I mean, I am a bit confused. Is there a simple way or is it going to be a mess all do be done from zero? Thanks for any help. Edoardo
I don't think there is a quick answer to your question, but I'd be willing to dialog with you about it for a while and share with you my techniques dealing with normalized databases. Beware though, I don't use a lot of what ADO.NET provides--instead, I tend to code client or server side SQL directly, depending on the requirements. That said, it seems that ADO.NET can handle relationships between tables, as long as you tell it what those relationships are, and it should handle updating records correctly (I think. I've never tried this). [personal comment--I've never used this feature because I think it is really stupid to duplicate the database model in the code: what if you want to change the DB model?] Also, have you set up foreign keys so that deletes and updates are cascaded? This can save you a lot of programming time. Also, if you can provide some specific examples of what you are trying to do, it might be easier to consider what the different solutions are and their benefits/drawbacks. Finally, hierarchical architectures are a PITA. Since you seem to only have a three level hierarchy, I think the best thing to do is to deal with the individual insert/update/delete/select statements. I had to create a model for a satellite company once that allowed basically infinite drill down in a hierarchy. Argh. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.