No Such Column Error In Android SQLite -


i created database. gives me "no such column error". i'm sure database have coloumn because used sqlite manager add data. don't understand why getting such error. i've searched question here, answers never helped me.

most of answers says if there no space between column name while writing code, gives error. think writed correctly.

public void oncreate(sqlitedatabase sqlitedatabase) {     sqlitedatabase.execsql(             "create table " + table_name + " ("            + bnum_col + " text, "            + pname_col + " text, "            + author_col + " text, "             + type_col + " text, "             + pyear_col + "integer );");   } 

my logcat showed me :

cursor c = db.query("btable", select, null, null, null, null, null, null); 

please me.

the last field has no space between column name , keyword integer. need change line:

+ pyear_col + "integer );"); 

to this:

+ pyear_col + " integer );");                ^                |                note space! 

a simple diagnostic tool track down these kinds of errors store sql query in variable , log before trying execute it. can examine logcat output see statement built.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -