jeudi 27 août 2015

Retrieving data from sqlite3 database( .db file) and storing it in a simple string in c++

I am using visual studio 2015 , basically i want to retrieve SOME data from sqlite database and store it in a string. the following code just displays the data on screen,,, is there any method through which i can store it in a string. PS: i have already created the table through command prompt..

 int main()
 {
   char *zErrMsg = 0;
   sqlite3 *db;
   int rc;
   rc = sqlite3_open("testingvisual.db", &db);

    //string sql;
    char *data;
  const char *sql;
  sql = "INSERT INTO TESTDATA VALUES (1,'test','test2');"; 
    sqlite3_exec(db, sql, callback, 0, &zErrMsg);
    sql = "SELECT * FROM TESTDATA WHERE id=1;";
   sqlite3_exec(db, sql, callback, 0, &zErrMsg);
  }

Aucun commentaire:

Enregistrer un commentaire