Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Location
    israel
    Posts
    7

    Unanswered: mysql in collaboration with c++

    I want to insert values to a mysql table from inside a c++ program such as:
    Code:
    int main()
    
       // the following is a mysql command
       use MyDb;
    
       for(int i=0; i++; i<10)
    
          // The following is a mysql command
          INSERT INTO MyTable(Counter)
         VALUES(i);
    
       return(0);
    can anyone explain me how i can contact my local mysql server (in 'localhost')
    and how do i write the above mysql lines in a c++ syntax ?
    Tanks !

  2. #2
    Join Date
    Jun 2004
    Posts
    9
    Hi,

    Haven't used C++ to conect to a MySQL db yet ...but you could probably try these links for more info:

    C connection API: http://dev.mysql.com/doc/mysql/en/my...l_connect.html

    C++ info:
    http://tangentsoft.net/mysql++/

  3. #3
    Join Date
    Oct 2004
    Location
    israel
    Posts
    7

    Thanks a lot !

    an i use the c code and save myself downloading mysql++?

  4. #4
    Join Date
    Dec 2004
    Posts
    3
    You need to link your program against the mysql client libraries , which provides you a set of API for connecting and quering the database. The steps are really simple.

    check out http://dev.mysql.com/doc/mysql/en/MySQL_APIs.html

    they are C API's can be very well used in C++ code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •