Results 1 to 4 of 4

Thread: C++ with Visual C++ 2008

  1. #1
    Join Date
    Feb 2009
    Posts
    83

    C++ with Visual C++ 2008

    I went back to C + + with Visual C + + 2008 Express to develop a small program ... i have a concern about the display of a result of a mysql query:

    Code:
    if (! mysql_real_connect (mySQL, "localhost", "root ",""," stock, 0, NULL, 0)) 
    ( 
    textBox1-> Text = "error"; 
    ) 
    else 
    ( 
    if (! mysql_query (mysql, "SELECT * FROM suppliers WHERE id = 2")) 
    ( 
    result = mysql_store_result (mySQL); 
    textBox2-> Text = System:: Convert:: ToString (mysql_num_fields (result)); 
    while (column = mysql_fetch_row (result)) 
    ( 
    textBox1-> Text = System:: Convert:: ToString (column [1]); 
    ) 
    mysql_free_result (result); 
    ) 
    else 
    ( 
    textBox1-> Text = "no result"; 
    ) 
    ) 
    mysql_close (mysql);
    When I run the program, I can see "True" in the textBox1 instead of the value that is in my database ... Which appears in the textBox2 is correct. Thank you for your help!

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: C++ with Visual C++ 2008

    It's not C + + is C + + / CLI And column [x] is a memory pointer, so it will be difficult to guess how to convert Otherwise you'd better to use mysql + +, it's much more convenient.

  3. #3
    Join Date
    Feb 2009
    Posts
    83

    Re: C++ with Visual C++ 2008

    if we explain how to use mysql + + with Visual C + + 2008 Express because I can not ... I am on Win XP, I installed mysql 5.1 and I have mysql + + 3.0.9.

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: C++ with Visual C++ 2008

    Code:
    mysqlpp:: Connection connection (false); 
    if (connection.connect ( "stock", "localhost", "root", "")) 
    ( 
    mysqlpp:: StoreQueryResult result; 
    mysqlpp:: Query query; 
    int id = 2; 
    query << "SELECT a, b, c FROM suppliers WHERE id =% 0q"; 
    q.parse (); 
    result = q.store (id); 
    if (result) 
    ( 
    for (mysqlpp:: StoreQueryResult:: iterator it = result.begin (); it! result.end = (); + + it) 
    ( 
    mysqlpp:: Row & row = const * it; 
    std:: string a = row [0]; 
    float b = row [1]; 
    int c = row [2]; 
    / / .. 
    ) 
    ) 
    )

Similar Threads

  1. A problem using cplex with visual c++ 2008
    By divange in forum Software Development
    Replies: 1
    Last Post: 31-05-2011, 08:25 AM
  2. help on visual basic 2008
    By gladys_ny in forum Software Development
    Replies: 1
    Last Post: 18-03-2011, 04:25 AM
  3. Replies: 2
    Last Post: 16-02-2011, 02:49 PM
  4. Difference between Visual studio 2005 and Visual studio 2008
    By RohanS in forum Software Development
    Replies: 3
    Last Post: 12-06-2009, 10:48 AM
  5. What is Visual Studio 2008
    By Jackie in forum Software Development
    Replies: 1
    Last Post: 23-12-2008, 05:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,297,073.04177 seconds with 16 queries