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 / C++ / MFC
  4. SDI Application - Multiple Tables

SDI Application - Multiple Tables

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelp
6 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.
  • U Offline
    U Offline
    User 1418550
    wrote on last edited by
    #1

    Hi friends.... I am working on a SDI application with database support. I require two tables for my application. While configuring the application wizard i specified both the tables in the Data Source when asked. Everything went fine. The application is running well. But if i want to add a new record in a table then it does not allow and states that "Database is Read Only". I went again making the same appliaction with a single table, and when i tried to add a new record it did successfully. Why is it happening that when using two tables the database is openeing as Read Only. I am not using Open function at all, since the application wizard itself opens it up. It happens fine when i use one table. It should do with two tables too. Please solve this problem of mine. Thanks. Pankaj

    D 1 Reply Last reply
    0
    • U User 1418550

      Hi friends.... I am working on a SDI application with database support. I require two tables for my application. While configuring the application wizard i specified both the tables in the Data Source when asked. Everything went fine. The application is running well. But if i want to add a new record in a table then it does not allow and states that "Database is Read Only". I went again making the same appliaction with a single table, and when i tried to add a new record it did successfully. Why is it happening that when using two tables the database is openeing as Read Only. I am not using Open function at all, since the application wizard itself opens it up. It happens fine when i use one table. It should do with two tables too. Please solve this problem of mine. Thanks. Pankaj

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Pankaj_Agarwal wrote: Why is it happening that when using two tables the database is openeing as Read Only. The query that was created no doubt has a JOIN in it. A JOINed query cannot be updated. You'll need to update each table separately.


      "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

      U 1 Reply Last reply
      0
      • D David Crow

        Pankaj_Agarwal wrote: Why is it happening that when using two tables the database is openeing as Read Only. The query that was created no doubt has a JOIN in it. A JOINed query cannot be updated. You'll need to update each table separately.


        "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

        U Offline
        U Offline
        User 1418550
        wrote on last edited by
        #3

        Hi, Can you please let me know how to perform this task. Or please let me know that how to use two or more tables in a SDI application so that at any place or time any table can be updated. Please do help meout !!!! Pankaj

        D 1 Reply Last reply
        0
        • U User 1418550

          Hi, Can you please let me know how to perform this task. Or please let me know that how to use two or more tables in a SDI application so that at any place or time any table can be updated. Please do help meout !!!! Pankaj

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Like I said, you'll need to update each table separately. For example, if table A had customer information in it and table B had order information in it, you would first add a new row to table A, then you would add a new row to table B. They would be "tied" together via the primary/foreign key.

          --------------- ---------------
          | Table A | | Table B |


          | Primary Key |------| Foreign Key |
          | Name | | Part # |
          | Address | | Quantity |
          | Phone | | |



          "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

          U 1 Reply Last reply
          0
          • D David Crow

            Like I said, you'll need to update each table separately. For example, if table A had customer information in it and table B had order information in it, you would first add a new row to table A, then you would add a new row to table B. They would be "tied" together via the primary/foreign key.

            --------------- ---------------
            | Table A | | Table B |


            | Primary Key |------| Foreign Key |
            | Name | | Part # |
            | Address | | Quantity |
            | Phone | | |



            "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

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

            Hi, Dear, this is the problem...my two tables are not related to each other. Actually one table has the header of the company which i am displaying on the top and the other table has all the details which has to be displayed, edited and add on the window. Both the tables have no relation at all with one another. In such a case what to do. And also if the tables have realtion as Primary Key- forign Key then as you said to update each table separately, in that case alsoboth the table firlds are being displayed on the window, and after a execute the AddNew (), it shows the error that the "Database is read only"... Please look into it. Thanks, Pankaj

            D 1 Reply Last reply
            0
            • U User 1418550

              Hi, Dear, this is the problem...my two tables are not related to each other. Actually one table has the header of the company which i am displaying on the top and the other table has all the details which has to be displayed, edited and add on the window. Both the tables have no relation at all with one another. In such a case what to do. And also if the tables have realtion as Primary Key- forign Key then as you said to update each table separately, in that case alsoboth the table firlds are being displayed on the window, and after a execute the AddNew (), it shows the error that the "Database is read only"... Please look into it. Thanks, Pankaj

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Pankaj_Agarwal wrote: Both the tables have no relation at all with one another. In such a case what to do. Start over. When AppWizard asks you for the table, only specify one of them, then create the other using ClassWizard. Or, create the application with no database support, then use ClassWizard to create two classes derived from CRecordset.


              "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

              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