sqlite - Android DB - Syntax error -


i want create db. here dbhelper

public class dbhelper extends sqliteopenhelper {  string tag = const.tag_db_helper;  public dbhelper(context context) {     super(context, const.db_table_name, null, 1); }  public void oncreate(sqlitedatabase db) {     db.execsql("create table " + const.db_table_name + " ("             + const.db_column_id_name + " integer primary key autoincrement,"             + const.db_column_name_name + " text,"             + const.db_column_from_name + " text,"             + const.db_column_to_name + " text,"             + const.db_column_days_name + " text,"             + const.db_column_sound_name + " text,"             + const.db_column_indicator_name + " text);");      log.w(tag, "database '" + const.db_table_name + "' created successfully!"); }  public void onupgrade(sqlitedatabase db, int oldversion, int newversion) {  } 

here vars:

static string db_table_name = "timetables"; static string db_column_id_name = "id"; static string db_column_name_name = "name"; static string db_column_days_name = "days"; static string db_column_from_name = "from"; static string db_column_to_name = "to"; static string db_column_sound_name = "sound"; static string db_column_indicator_name = "indicator"; 

but when time create db i've got error. here is:

android.database.sqlite.sqliteexception: near "from": syntax error (code 1): , while compiling: create table timetables (id integer primary key autoincrement,name text,from text,to text,days text,sound text,indicator text);         @ android.database.sqlite.sqliteconnection.nativepreparestatement(native method)         @ android.database.sqlite.sqliteconnection.acquirepreparedstatement(sqliteconnection.java:889)         @ android.database.sqlite.sqliteconnection.prepare(sqliteconnection.java:500)         @ android.database.sqlite.sqlitesession.prepare(sqlitesession.java:588)         @ android.database.sqlite.sqliteprogram.<init>(sqliteprogram.java:58)         @ android.database.sqlite.sqlitestatement.<init>(sqlitestatement.java:31)         @ android.database.sqlite.sqlitedatabase.executesql(sqlitedatabase.java:1674)         @ android.database.sqlite.sqlitedatabase.execsql(sqlitedatabase.java:1605)         @ ru.sergey.timetable.dbhelper.oncreate(dbhelper.java:21)         @ android.database.sqlite.sqliteopenhelper.getdatabaselocked(sqliteopenhelper.java:251)         @ android.database.sqlite.sqliteopenhelper.getwritabledatabase(sqliteopenhelper.java:163)         @ ru.sergey.timetable.utils.addtimetabletodb(utils.java:35)         @ ru.sergey.timetable.addtimetableactivity.onclick(addtimetableactivity.java:132)         @ android.view.view.performclick(view.java:4780)         @ android.view.view$performclick.run(view.java:19866)         @ android.os.handler.handlecallback(handler.java:739)         @ android.os.handler.dispatchmessage(handler.java:95)         @ android.os.looper.loop(looper.java:135)         @ android.app.activitythread.main(activitythread.java:5254)         @ java.lang.reflect.method.invoke(native method)         @ java.lang.reflect.method.invoke(method.java:372)         @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903)         @ com.android.internal.os.zygoteinit.main(zygoteinit.java:698) 

as understand, there wrong dbhelper , near 'from' column, right? i've checked every symbol. ideas?

thanks in advance, sergarus

from , to reserved keywords. please choose other names columns.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -