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. Dialog Window supporting Database ???

Dialog Window supporting Database ???

Scheduled Pinned Locked Moved C / C++ / MFC
databasetutorialquestion
7 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.... I wanted to know whether we can create a dialog based Appliocation having document/view support, indirectly saying to have databse support in a dialog base application. After entering the application wizard, in the second step it asks for the type of application to be built. if we go for SDI or MDI we can choose the document/view option and then canchoose our data source. But if we choose the dialog based application, then the option for choosing the data source is no more available. Now how to give this dialog based application the database connectivity ??????? And further more if we are calling further more dialogs from the first dialog window then the connectivity should be there for all the windows. Anyone..... Pankaj

    S 1 Reply Last reply
    0
    • U User 1418550

      Hi.... I wanted to know whether we can create a dialog based Appliocation having document/view support, indirectly saying to have databse support in a dialog base application. After entering the application wizard, in the second step it asks for the type of application to be built. if we go for SDI or MDI we can choose the document/view option and then canchoose our data source. But if we choose the dialog based application, then the option for choosing the data source is no more available. Now how to give this dialog based application the database connectivity ??????? And further more if we are calling further more dialogs from the first dialog window then the connectivity should be there for all the windows. Anyone..... Pankaj

      S Offline
      S Offline
      Sujan Christo
      wrote on last edited by
      #2

      Hi, Create a Dialogbased application, Add a new class to it using classwizard. Choose the base class 4 the newclass as CRecordSet, it will ask 4 the other db informations Sujan

      U 1 Reply Last reply
      0
      • S Sujan Christo

        Hi, Create a Dialogbased application, Add a new class to it using classwizard. Choose the base class 4 the newclass as CRecordSet, it will ask 4 the other db informations Sujan

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

        Tha is okay....but when it comes to attaching the member variables with the fields of the database, then the CRecordView class is required. I stuck up here when i have to attach the member variables. Please help in this matter then i suppose it will work successfully !!! Do reply.... Pankaj

        S 1 Reply Last reply
        0
        • U User 1418550

          Tha is okay....but when it comes to attaching the member variables with the fields of the database, then the CRecordView class is required. I stuck up here when i have to attach the member variables. Please help in this matter then i suppose it will work successfully !!! Do reply.... Pankaj

          S Offline
          S Offline
          Sujan Christo
          wrote on last edited by
          #4

          Hi, while adding the Class itself, it will ask for the name of the datasource/db. When you give it, it will automatically add the fields to the newly created class, which is derived from CRecordSet. Where R U getting the CRecordView ???. Sujan

          U 1 Reply Last reply
          0
          • S Sujan Christo

            Hi, while adding the Class itself, it will ask for the name of the datasource/db. When you give it, it will automatically add the fields to the newly created class, which is derived from CRecordSet. Where R U getting the CRecordView ???. Sujan

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

            My Friend... I have done what all you said. I made my own class which had the base class as CRecordSet. It asked for the details of the database and everything else. It created the class in which all the field members of the database were accesed by a global variable m_pSet, for eg. m_pSet -> Name where Name is a field of the database. Now i have, say a edit box on my dialog resource, and i want to display the Name field in it. I will go to the class Wizard and Member Variable Tab. there i will have to assign the variable of this edit box, say IDC_NAME = m_pSet -> Name Now since there is no CRecordView class, so this cannot happen, which in the normal cases of SDI or MDI which have CRecordView as the base class give the option to assign these variables. My problem lies here that how to assign any resource variable to the field variable as i said above. Please do let me know how this can happen.... Pankaj

            S 1 Reply Last reply
            0
            • U User 1418550

              My Friend... I have done what all you said. I made my own class which had the base class as CRecordSet. It asked for the details of the database and everything else. It created the class in which all the field members of the database were accesed by a global variable m_pSet, for eg. m_pSet -> Name where Name is a field of the database. Now i have, say a edit box on my dialog resource, and i want to display the Name field in it. I will go to the class Wizard and Member Variable Tab. there i will have to assign the variable of this edit box, say IDC_NAME = m_pSet -> Name Now since there is no CRecordView class, so this cannot happen, which in the normal cases of SDI or MDI which have CRecordView as the base class give the option to assign these variables. My problem lies here that how to assign any resource variable to the field variable as i said above. Please do let me know how this can happen.... Pankaj

              S Offline
              S Offline
              Sujan Christo
              wrote on last edited by
              #6

              Oh 4 that, you must have to add a member variable to the edit control say m_myname, and you must have to passon the value m_pSet->Name into this and must have to call updateData function m_myname = m_pSet->Name UpdateData(FALSE); The best way is to write a function say getvalues(), which gets all the values from the recordset and displays it on the dialog. I do think there is another way to bind direclty is there, but couldn't remember it. Just go throught the MSDN. Usually what i'll do is i'll write my own class 4 data manipulation Sujan

              U 1 Reply Last reply
              0
              • S Sujan Christo

                Oh 4 that, you must have to add a member variable to the edit control say m_myname, and you must have to passon the value m_pSet->Name into this and must have to call updateData function m_myname = m_pSet->Name UpdateData(FALSE); The best way is to write a function say getvalues(), which gets all the values from the recordset and displays it on the dialog. I do think there is another way to bind direclty is there, but couldn't remember it. Just go throught the MSDN. Usually what i'll do is i'll write my own class 4 data manipulation Sujan

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

                Thanks....this is one method that did not strike me....this can be done and i am sure it will work. But usually what happens is that in the class wizard we get a combo box in which all the member variables are stored by default, we just have to choose for which resource which field variable we have to assign. In this case no coding is required. But as you said i think by coding in this manner, the work will be done. Anyways, Thanks a lot !!! Regards, Pankaj

                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