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. Mysql Select * from Table

Mysql Select * from Table

Scheduled Pinned Locked Moved C / C++ / MFC
helpdatabasemysqlcomquestion
6 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.
  • D Offline
    D Offline
    Davitor
    wrote on last edited by
    #1

    Hi All i am useing _ConnectionPtr and _RecordsetPtr for connection and get information from mysql databases.i have a problem to get values when i am useing "Select * from table".How can i get table information.

    _ConnectionPtr pConn = NULL;
    // Define string variables for ADO connection
    _bstr_t strCon("Driver={MySQL ODBC 5.1 Driver};Database="";User=root; Password=root;Option=3;");

    HRESULT hr = S\_OK;
    
    //Initialize the COM Library
    CoInitialize(NULL);
    
       hr = pConn.CreateInstance((\_\_uuidof(Connection)));
        if(FAILED(hr))
        {
            AfxMessageBox("Error instantiating Connection object\\n");
           
        }
    
    
        hr = pConn->Open(strCon,"root","root",0);
        if(FAILED(hr))
        {
            AfxMessageBox("Error Opening Database object using ADO \_ConnectionPtr \\n");
            
        }
    	
    	
    
    	::\_RecordsetPtr rs;
    
    	rs = pConn->Execute(\_bstr\_t("use Databases"), 0, adCmdText);
    	
    	 rs = pConn->Execute(\_bstr\_t("Select \* from tatblename"), 0, adCmdText);
    

    Plz help me

    R D 2 Replies Last reply
    0
    • D Davitor

      Hi All i am useing _ConnectionPtr and _RecordsetPtr for connection and get information from mysql databases.i have a problem to get values when i am useing "Select * from table".How can i get table information.

      _ConnectionPtr pConn = NULL;
      // Define string variables for ADO connection
      _bstr_t strCon("Driver={MySQL ODBC 5.1 Driver};Database="";User=root; Password=root;Option=3;");

      HRESULT hr = S\_OK;
      
      //Initialize the COM Library
      CoInitialize(NULL);
      
         hr = pConn.CreateInstance((\_\_uuidof(Connection)));
          if(FAILED(hr))
          {
              AfxMessageBox("Error instantiating Connection object\\n");
             
          }
      
      
          hr = pConn->Open(strCon,"root","root",0);
          if(FAILED(hr))
          {
              AfxMessageBox("Error Opening Database object using ADO \_ConnectionPtr \\n");
              
          }
      	
      	
      
      	::\_RecordsetPtr rs;
      
      	rs = pConn->Execute(\_bstr\_t("use Databases"), 0, adCmdText);
      	
      	 rs = pConn->Execute(\_bstr\_t("Select \* from tatblename"), 0, adCmdText);
      

      Plz help me

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      I don't know who in the living frock is marking your questions as "Good" (apparently none of your questions are that awesome to be marked as a good questions). I've noticed this a few times and I wonder if you have a split personality (another login) to "help yourself"? Remember - the ones likely to provide you an useful answer do not care about if or not the query is marked as good.

      It is a crappy thing, but it's life -^ Carlo Pallini

      D 1 Reply Last reply
      0
      • R Rajesh R Subramanian

        I don't know who in the living frock is marking your questions as "Good" (apparently none of your questions are that awesome to be marked as a good questions). I've noticed this a few times and I wonder if you have a split personality (another login) to "help yourself"? Remember - the ones likely to provide you an useful answer do not care about if or not the query is marked as good.

        It is a crappy thing, but it's life -^ Carlo Pallini

        D Offline
        D Offline
        Davitor
        wrote on last edited by
        #3

        Plz don't blame

        (another login) to "help yourself"

        Thanks for comment.

        R 1 Reply Last reply
        0
        • D Davitor

          Plz don't blame

          (another login) to "help yourself"

          Thanks for comment.

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          It was only a doubt that I had, so I expressed it instead of keeping it on my mind. Not that I'm blaming you for anything, and I'm glad you've clarified it.

          It is a crappy thing, but it's life -^ Carlo Pallini

          D 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            It was only a doubt that I had, so I expressed it instead of keeping it on my mind. Not that I'm blaming you for anything, and I'm glad you've clarified it.

            It is a crappy thing, but it's life -^ Carlo Pallini

            D Offline
            D Offline
            Davitor
            wrote on last edited by
            #5

            Thank to you also.

            1 Reply Last reply
            0
            • D Davitor

              Hi All i am useing _ConnectionPtr and _RecordsetPtr for connection and get information from mysql databases.i have a problem to get values when i am useing "Select * from table".How can i get table information.

              _ConnectionPtr pConn = NULL;
              // Define string variables for ADO connection
              _bstr_t strCon("Driver={MySQL ODBC 5.1 Driver};Database="";User=root; Password=root;Option=3;");

              HRESULT hr = S\_OK;
              
              //Initialize the COM Library
              CoInitialize(NULL);
              
                 hr = pConn.CreateInstance((\_\_uuidof(Connection)));
                  if(FAILED(hr))
                  {
                      AfxMessageBox("Error instantiating Connection object\\n");
                     
                  }
              
              
                  hr = pConn->Open(strCon,"root","root",0);
                  if(FAILED(hr))
                  {
                      AfxMessageBox("Error Opening Database object using ADO \_ConnectionPtr \\n");
                      
                  }
              	
              	
              
              	::\_RecordsetPtr rs;
              
              	rs = pConn->Execute(\_bstr\_t("use Databases"), 0, adCmdText);
              	
              	 rs = pConn->Execute(\_bstr\_t("Select \* from tatblename"), 0, adCmdText);
              

              Plz help me

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

              Davitor wrote:

              i have a problem to get values when i am useing "Select * from table".

              Are we supposed to guess at this problem?

              Davitor wrote:

              ::_RecordsetPtr rs;

              Do you need to call CreateInstance() on the rs object before using it?

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "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

              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