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. Visual Basic
  4. a database problem !

a database problem !

Scheduled Pinned Locked Moved Visual Basic
questioncssdatabasedesignhelp
5 Posts 4 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.
  • U Offline
    U Offline
    User 525510
    wrote on last edited by
    #1

    I don't know yet if anyone has this problem! Let's say that I have a database that will store all the information about an order and items and customers… each have a table that is related to the other… The Problem is that the design of the database is not friendly to the user, this mean if I want to put a Data Grid and bind it to the OrderDetails table, then the user will see the ItemId and not the ItemName (Of cores, because the database is will normalized !). So, to work around this problem a made another User-Friendly table and each time the user ask to see an order detail, the code will translate the data from the original Unfriendly table to the friendly table… This worked fine, but what I would do if the user decides to make changes to the order? Again I have to copy the data from the User-Friendly table to the database (unfriendly table!). This is a complex operation and very hard to do, especially if there is a large number of a table I work with in my original database… I have the same problem if I want to use crystal report! Because crystal report will not deal with a large number of related tables, I am forced to make a new table that is a copy of my report design, and each time the user ask to print a report, the data will be transformed to this table, so crystal report can deal with it fine and print the report !! The question is: if there is a problem with my design concept or I should built a new object that inherit from the dataset object and can join tables together and can send the data back to the original database??? And how to do this??

    B C E 3 Replies Last reply
    0
    • U User 525510

      I don't know yet if anyone has this problem! Let's say that I have a database that will store all the information about an order and items and customers… each have a table that is related to the other… The Problem is that the design of the database is not friendly to the user, this mean if I want to put a Data Grid and bind it to the OrderDetails table, then the user will see the ItemId and not the ItemName (Of cores, because the database is will normalized !). So, to work around this problem a made another User-Friendly table and each time the user ask to see an order detail, the code will translate the data from the original Unfriendly table to the friendly table… This worked fine, but what I would do if the user decides to make changes to the order? Again I have to copy the data from the User-Friendly table to the database (unfriendly table!). This is a complex operation and very hard to do, especially if there is a large number of a table I work with in my original database… I have the same problem if I want to use crystal report! Because crystal report will not deal with a large number of related tables, I am forced to make a new table that is a copy of my report design, and each time the user ask to print a report, the data will be transformed to this table, so crystal report can deal with it fine and print the report !! The question is: if there is a problem with my design concept or I should built a new object that inherit from the dataset object and can join tables together and can send the data back to the original database??? And how to do this??

      B Offline
      B Offline
      BlackDice
      wrote on last edited by
      #2

      I'm not very familiar with crystal reports, but as far as the grid goes, I never use a data-bound anything. You should populate the grid from an SQL statement, then if you're allowing them to edit stuff right in the grid ( which I also don't do), make sure that once they leave that record you use an insert or update statement depending on which fields were edited or added. If it's broken, I probably did it bdiamond

      1 Reply Last reply
      0
      • U User 525510

        I don't know yet if anyone has this problem! Let's say that I have a database that will store all the information about an order and items and customers… each have a table that is related to the other… The Problem is that the design of the database is not friendly to the user, this mean if I want to put a Data Grid and bind it to the OrderDetails table, then the user will see the ItemId and not the ItemName (Of cores, because the database is will normalized !). So, to work around this problem a made another User-Friendly table and each time the user ask to see an order detail, the code will translate the data from the original Unfriendly table to the friendly table… This worked fine, but what I would do if the user decides to make changes to the order? Again I have to copy the data from the User-Friendly table to the database (unfriendly table!). This is a complex operation and very hard to do, especially if there is a large number of a table I work with in my original database… I have the same problem if I want to use crystal report! Because crystal report will not deal with a large number of related tables, I am forced to make a new table that is a copy of my report design, and each time the user ask to print a report, the data will be transformed to this table, so crystal report can deal with it fine and print the report !! The question is: if there is a problem with my design concept or I should built a new object that inherit from the dataset object and can join tables together and can send the data back to the original database??? And how to do this??

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        I agree with bdiamond on this. Data Binding a UI control directly to the database IMO violates the proper layering of a solution. The layers are presentation (that communicates with the user), business (it performs the business logic, validation, enforces the rules of the system and so on) and data (this communicates with the database). The layers should only talk to the adjacent layer. The larger the project the more important this is. For a smaller project then the layers can get fuzzy as it is not so important. If you must use data-binding then having the binding done on the result of a Stored procedure would be better because the stored procedure can join the "friendly" table with the other table. From the sound of what you are doing I'm not convinced that the addition of your friendly table is aiding the normalisation. The 5th-Normal-Form IIRC is where you create lookup tables that are used to expand enumeration so should increase the normalisation of your database, but from your description you seem to be denormalising the database - expecially if changes in one table require a change in the other.


        "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar

        1 Reply Last reply
        0
        • U User 525510

          I don't know yet if anyone has this problem! Let's say that I have a database that will store all the information about an order and items and customers… each have a table that is related to the other… The Problem is that the design of the database is not friendly to the user, this mean if I want to put a Data Grid and bind it to the OrderDetails table, then the user will see the ItemId and not the ItemName (Of cores, because the database is will normalized !). So, to work around this problem a made another User-Friendly table and each time the user ask to see an order detail, the code will translate the data from the original Unfriendly table to the friendly table… This worked fine, but what I would do if the user decides to make changes to the order? Again I have to copy the data from the User-Friendly table to the database (unfriendly table!). This is a complex operation and very hard to do, especially if there is a large number of a table I work with in my original database… I have the same problem if I want to use crystal report! Because crystal report will not deal with a large number of related tables, I am forced to make a new table that is a copy of my report design, and each time the user ask to print a report, the data will be transformed to this table, so crystal report can deal with it fine and print the report !! The question is: if there is a problem with my design concept or I should built a new object that inherit from the dataset object and can join tables together and can send the data back to the original database??? And how to do this??

          E Offline
          E Offline
          Edbert P
          wrote on last edited by
          #4

          I wholeheartedly agree with the comments from the people above. Your database seems to be normalised database and if you cannot bind it directly to the DataGrid it is best to bind it to several other controls (e.g. using textboxes, comboboxes, etc.) instead of creating the 'friendly' table and bind it to one DataGrid. For crystal report, it is always best to create your own queries and use the queries to build the report, instead of linking the tables in crystal report itself. Trust me, you'll be thankful that you use queries instead of tables when your database changes. The answer is: The database sounds normalised and seems to be fine. Your approach is not recommendable and you should read more about binding data to the form and get some examples before continuing. Edbert P. Sydney, Australia.

          U 1 Reply Last reply
          0
          • E Edbert P

            I wholeheartedly agree with the comments from the people above. Your database seems to be normalised database and if you cannot bind it directly to the DataGrid it is best to bind it to several other controls (e.g. using textboxes, comboboxes, etc.) instead of creating the 'friendly' table and bind it to one DataGrid. For crystal report, it is always best to create your own queries and use the queries to build the report, instead of linking the tables in crystal report itself. Trust me, you'll be thankful that you use queries instead of tables when your database changes. The answer is: The database sounds normalised and seems to be fine. Your approach is not recommendable and you should read more about binding data to the form and get some examples before continuing. Edbert P. Sydney, Australia.

            U Offline
            U Offline
            User 525510
            wrote on last edited by
            #5

            thanks for all pepole that answer my question (and because my english is not good i can't find the words that express my felling...) ok, it's fine, i build the query that will create my friendly table and i generated the dataset that will hold the results and bind it to a datagrid (it is not possible to bind an order form to textboxes or anything else!! the datagrid is the excellent choice), but there is 2 problem i think: the first problem is what will happen if the user decide to make a change to the order ? the second problem is that i use the Ado.Net (and dataset) because i can use the data in a 'disconnected world' ! this mean that i need to work with the data for a long time (2 day maybe) befor i send finaly the data to the databse. so i can't use the T_Sql queries ! (because i need a connection to the datasource that is not availalble all the time !). so i always connect to the datasource, copy a portion of data to a local XML file, save it to disk to work with it, so i always work with DataView objects to make my queries ! my datasource is most the time is a local XML file that a dataset object will read when the application start !! so what is the solution !!

            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