VALUES is used for INSERTing into a table, not for SELECTing. This is not
valid SQL (I would help you fix it, but I can't figure out what you were
trying to achieve.)
Here is a great reference: http://sqlite.org/lang_select.html

On Thu, Sep 6, 2012 at 11:18 AM, Arbol One <[email protected]> wrote:

> As many of you know, I am trying to learn SQL using C++.
>
> Below is an error I get when I try using the C++ example below it.
>
>
>
> Error Code: 1
>
> Error Message: near "VALUES": syntax error
>
> --------------------------------------------
>
>
>
>     Glib::ustring apstr;
>
>     Glib::ustring sName;
>
>     int apint;
>
>     mySQLite3* db;
>
>     try {
>
>         db = new mySQLite3(db_name.c_str());
>
>     } catch(somexception& e) {
>
>         //do something
>
>     }
>
>
>
>    // SQL statement
>
>     apstr = "SELECT fname FROM ";
>
>     apstr += this->db_table_name;
>
>     apstr += " WHERE title = ";
>
>     apstr += token;
>
>     apstr += " (n_id, title, fname, mname, lname) VALUES (?, ?, ?, ?, ?)";
> // here is where the problem is see the method below
>
>     apint = 1;
>
>     db->setStmt(apstr);
>
>     sName = db->read_str(apint);
>
>
>
> --------------------------------------------
>
> const Glib::ustring& mySQLite3::read_str(const int pos)
>
> throw(jme::Exception) {
>
>
>
>     rc = sqlite3_prepare_v2(db, this->SQLStatement.c_str(), -1, &mystmt,
> NULL);
>
>     if(rc != SQLITE_OK) {
>
>         // do something
>
>     }
>
>     rc = sqlite3_step(mystmt);
>
>     if(rc == SQLITE_ROW ) {
>
>         apstr = (const char*)sqlite3_column_text(mystmt,pos);
>
>     }
>
>     try {
>
>         this->finalize();
>
>     } catch(somexception& e) {
>
>         throw e;
>
>     }
>
>     return apstr;
>
> }
>
> What am I doing wrong?
>
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to