SQlitecpp: fails to fetch data from database
<p>Here is how my code looks </p>

<pre><code>    lk_dispclr();                                 
    strcpy(menu.title,"Login");

    int res=0;
    prn_open();

    lk_bkl_timeout(20);
    lk_dispclr();
    lcd::DisplayText(1,0,"1.User Menu ",0);
    lcd::DisplayText(4,0,"Press any key",0);
    lk_getkey();

    while(1)
    {
        char user[10]={0};
        lk_dispclr();
        lcd::DisplayText(2,0,"Enter Username",0);
        res=lk_getalpha(4,0,(unsigned char *)user,9,strlen(user),0);
        if(res&gt;0)
        {
            user[res]='\0';

            printf("Username is %s %d\n",user,res);
            klok::pc::User userObj;
            if(klok::pc::User::FromDatabase(getDatabase(),user,userObj) != 0)
            {
                printf("No Such User %s\n", user);
                continue;
            }
            if(userObj.id == user)
            {
                while(1)
                {
                    char pwd[10]={0};
                    lk_dispclr();
                    lcd::DisplayText(2,0,"Enter Password",0);
                    res=lk_getpassword((unsigned char *)pwd,4,9);
                    if (res&gt;0)
                    {
                        pwd[res]='\0';
                        printf("Password is %s %d\n",pwd,res);
                        if(userObj.password == pwd )
                        {
                            gUserName = user;
                            main_menu(user,pwd);
                            printf("main_menu\n");
                        }
                        else
                        {
                            goto AGAIN_ASK_USER_DETAILS;
                        }
                    }
                }
            }
        }
AGAIN_ASK_USER_DETAILS:
        while(false);
}
</code></pre>

<p><strong>Database helper</strong> </p>

<pre><code>#include "PosDataStructures.hpp"
#include &lt;SQLiteCpp/SQLiteCpp.h&gt;

namespace klok {
    namespace pc {

            namespace {

                using SQLite::Database;
                using SQLite::Column;
                using SQLite::Statement;

            }

            int32_t User::FromDatabase(SQLite::Database &amp; db,const char * id,User &amp; outUser){

                const std::string queryString = "SELECT * FROM ? WHERE User_ID=?";
                try
                {
                    SQLite::Statement query(db,User::Queries::SELECT_USER_WITH_ID_FROM_TABLE);
                    query.bind(1,User::Queries::TABLE_NAME);
                    query.bind(2,id);

                    if(query.executeStep())
                    {
                        outUser.id = query.getColumn(0).getString();
                        outUser.name = query.getColumn(1).getString();
                        outUser.password = query.getColumn(2).getString();
                        return 0;
                    }
                    else
                    {
                        return -1;
                    }
                }
                catch(std::exception &amp; e)
                {
                    std::printf("User::FromDatabase -&gt; Fatal Error %s\n", e.what());
                    return -1;
                }

                return 0;
            }

            int32_t User::CreateTable(SQLite::Database &amp; db,bool dropIfExist){
                const std::string queryString = "SELECT * FROM pay_coll_user WHERE User_ID=?";
                try
                {
                    SQLite::Statement query(db,queryString);
                    if(query.executeStep()) {
                        return 0;
                    }
                    else {
                        return -1;
                    }
                }
                catch(std::exception &amp; e)
                {
                    std::printf("User::CreateTable -&gt; Fatal Error %s\n", e.what());
                    return -1;
                }

                return 0;
            }
            const char * User::Queries::TABLE_NAME = "pay_coll_user";
            const char * User::Queries::SELECT_USER_WITH_ID_FROM_TABLE = "SELECT * FROM ? WHERE User_ID=?";
            const char * User::Queries::CREATE_USER_TABLE_QUERY =   "CREATE TABLE ? (" 
                                                                    "User_ID       INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," 
                                                                    "User_Name   VARCHAR(20) NOT NULL UNIQUE," 
                                                                    "Password        VARCHAR(8) NOT NULL );";
            const char * User::Queries::DROP_USER_TABLE_QUERY = "DROP TABLE ? IF EXISTS;";
    }
} 
</code></pre>

<p>in my databse (<strong>PayCollect.db</strong>) i have table pay_coll_user with User_ID , Username , password column</p>

<p>1st user id is 101010, name paul , pass 123456</p>

<p>but when i test this code on device it throws error </p>

<p><strong>User::FromDatabase -> Fatal Error near "?": syntax error
No Such User 101010</strong></p>