Hi all,

I want to encapsulate a function for checking the count of records
satisfying some condition in some table, the code is just like
following shown:

String sql = "select count(*) from ?;";
SQLiteStatement state = mDb.compileStatement(sql);

state.bindString(0, TABLE_NAME);
return state.simpleQueryForLong();

But unfortunately, an exception is threw when the command
compileStatement is executed. I've checked the output log, and find
following log:

android.database.sqlite.SQLiteException: near "?": syntax error: ,
while compiling: select count(*) from ?;

But if I replaced the "?" with the actual table name, it works fine.

Could anyone help me for this issue?

Thanks,

Stanley

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to