Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Complex relational database

Complex relational database

Scheduled Pinned Locked Moved C#
databasequestioncsharpsql-serversysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    laphijia
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • L laphijia

      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

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups