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. Adodc : how to retrieve single value into EditBox

Adodc : how to retrieve single value into EditBox

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
9 Posts 3 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.
  • C Offline
    C Offline
    coolerfantasy
    wrote on last edited by
    #1

    hi every body i am trying to retrieve a single value from Adodc into EditBox here i got an error :- m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName"); where "StockName" field of names in my table "Stocks" the error :- binary : '=' no right side takes class tagVariant , or no convertion available im working with "visual c++ 6 / mfc" dialog based project thank you in advance .

    D 1 Reply Last reply
    0
    • C coolerfantasy

      hi every body i am trying to retrieve a single value from Adodc into EditBox here i got an error :- m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName"); where "StockName" field of names in my table "Stocks" the error :- binary : '=' no right side takes class tagVariant , or no convertion available im working with "visual c++ 6 / mfc" dialog based project thank you in advance .

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

      What is m_edit1?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

      C 1 Reply Last reply
      0
      • D David Crow

        What is m_edit1?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

        C Offline
        C Offline
        coolerfantasy
        wrote on last edited by
        #3

        m_edit1 is a member variable for the EditBox , EditBox is one of the tools which used in Dialogs it has the class CEdit , EditBox in visual C++ is similar to textbox in visual basic ;)

        F 1 Reply Last reply
        0
        • C coolerfantasy

          m_edit1 is a member variable for the EditBox , EditBox is one of the tools which used in Dialogs it has the class CEdit , EditBox in visual C++ is similar to textbox in visual basic ;)

          F Offline
          F Offline
          Freak30
          wrote on last edited by
          #4

          I think the question was, whether m_edit1 is a control member (i.e. CEditControl) or a data member (CString). In the former case you would need m_edit1.SetWindowText(content) to display the content. In any case you need to extract (or convert to) a CString from the variant that you have as input.

          The good thing about pessimism is, that you are always either right or pleasently surprised.

          C 1 Reply Last reply
          0
          • F Freak30

            I think the question was, whether m_edit1 is a control member (i.e. CEditControl) or a data member (CString). In the former case you would need m_edit1.SetWindowText(content) to display the content. In any case you need to extract (or convert to) a CString from the variant that you have as input.

            The good thing about pessimism is, that you are always either right or pleasently surprised.

            C Offline
            C Offline
            coolerfantasy
            wrote on last edited by
            #5

            an example would clear the case thanx .

            F 1 Reply Last reply
            0
            • C coolerfantasy

              an example would clear the case thanx .

              F Offline
              F Offline
              Freak30
              wrote on last edited by
              #6

              If m_edit1 is a data member it would be something like that.

              m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString();

              If m_edit1 is a control member it would look like that instead.

              m_edit1.SetWindowText(m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString());

              In both cases GetString() is a placeholder for the function to extract a String representation from the tagVariant. You should check the documentation (or intelli sense) for the correct function name.

              The good thing about pessimism is, that you are always either right or pleasently surprised.

              C 1 Reply Last reply
              0
              • F Freak30

                If m_edit1 is a data member it would be something like that.

                m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString();

                If m_edit1 is a control member it would look like that instead.

                m_edit1.SetWindowText(m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString());

                In both cases GetString() is a placeholder for the function to extract a String representation from the tagVariant. You should check the documentation (or intelli sense) for the correct function name.

                The good thing about pessimism is, that you are always either right or pleasently surprised.

                C Offline
                C Offline
                coolerfantasy
                wrote on last edited by
                #7

                i made it ,,, partially !! to inform you about my mdb file :- its name (inventory.mdb) it hase one table (Stocks) the fields are (StockName,StockID,...) now i can extract values from only the "StockName" which its string values by the following code in button click :-

                m_ado.SetRecordSource ("SELECT * FROM Stocks");
                m_ado.Refresh ();
                C_Recordset m_Record = m_ado.GetRecordset ();// this line can be omitted !

                COleVariant var1;
                var1.vt = VT_I2;
                var1.iVal = 1;
                COleVariant value = m_ado.GetRecordset().GetFields().GetItem(var1).GetValue ();
                m_edit = value.bstrVal;

                UpdateData (FALSE);
                

                how to extract the other values such as "StockID" which its integer or any other fields ? thanx .

                D 1 Reply Last reply
                0
                • C coolerfantasy

                  i made it ,,, partially !! to inform you about my mdb file :- its name (inventory.mdb) it hase one table (Stocks) the fields are (StockName,StockID,...) now i can extract values from only the "StockName" which its string values by the following code in button click :-

                  m_ado.SetRecordSource ("SELECT * FROM Stocks");
                  m_ado.Refresh ();
                  C_Recordset m_Record = m_ado.GetRecordset ();// this line can be omitted !

                  COleVariant var1;
                  var1.vt = VT_I2;
                  var1.iVal = 1;
                  COleVariant value = m_ado.GetRecordset().GetFields().GetItem(var1).GetValue ();
                  m_edit = value.bstrVal;

                  UpdateData (FALSE);
                  

                  how to extract the other values such as "StockID" which its integer or any other fields ? thanx .

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

                  coolerfantasy wrote:

                  how to extract the other values such as "StockID" which its integer or any other fields ?

                  See if this article is of any use.

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

                  C 1 Reply Last reply
                  0
                  • D David Crow

                    coolerfantasy wrote:

                    how to extract the other values such as "StockID" which its integer or any other fields ?

                    See if this article is of any use.

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

                    C Offline
                    C Offline
                    coolerfantasy
                    wrote on last edited by
                    #9

                    thank you and thanx to all those posting my Question its solved .. :-D

                    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