Not sure about SQLite, but "order" is a reserved word for SQL, maybe that is the issue maybe try "orders" instead.
On Tue, Apr 16, 2013 at 10:17 PM, shoaib khan <skksho...@gmail.com> wrote: > I am creating a table named order in the database order.db. > I am getting error during the execution of the function call > "database.execSQL(DATABASE_CREATE)". > > Error is as follows: > > 04-17 02:06:35.014: E/AndroidRuntime(4612): > android.database.sqlite.SQLiteException: near "order": syntax error (code > 1): , while compiling: create table order ( _id integer primary key > autoincrement, orderName text not null, orderCommission text not null, > orderDate text not null, orderSlot text not null, orderGain text not null, > orderNO text not null, orderValue text not null); > > > package com.shoaib.lotteryerp.helper; > > import android.content.Context; > import android.database.sqlite.SQLiteDatabase; > import android.database.sqlite.SQLiteOpenHelper; > import android.util.Log; > > public class MySQLiteHelperOrder extends SQLiteOpenHelper { > > public static final String TABLE_ORDER = "Order"; > public static final String COLUMN_ID = "_id"; > public static final String COLUMN_NAME = "orderName"; > public static final String COLUMN_DATE="orderDate"; > public static final String COLUMN_ORDERNO="orderNO"; > public static final String COLUMN_SLOT="orderSlot"; > > public static final String COLUMN_ORDERVALUE="orderValue"; > public static final String COLUMN_COMMISSION="orderCommission"; > public static final String COLUMN_GAIN="orderGain"; > private static final String DATABASE_NAME = "order.db"; > private static final int DATABASE_VERSION = 2; > > // Database creation sql statement > private static final String DATABASE_CREATE = "create table " > + TABLE_ORDER + "(" + COLUMN_ID > + " integer primary key autoincrement, " + COLUMN_NAME > + " text not null, " + COLUMN_COMMISSION + " text not > null, " > + COLUMN_DATE + " text not null, " > + COLUMN_SLOT + " text not null, " > + COLUMN_GAIN + " text not null, " > + COLUMN_ORDERNO + " text not null, " + COLUMN_ORDERVALUE > + " text not null);"; > > MySQLiteHelperOrder(Context context) { > super(context, DATABASE_NAME, null, DATABASE_VERSION); > } > > public void onCreate(SQLiteDatabase database) { > database.execSQL(DATABASE_CREATE); > } > > public void onUpgrade(SQLiteDatabase db, int oldVersion, int > newVersion) { > Log.w(MySQLiteHelperOrder.class.getName(), > "Upgrading database from version " + oldVersion + " to > " > + newVersion + ", which will destroy all old > data"); > db.execSQL("DROP TABLE IF EXISTS " + TABLE_ORDER); > onCreate(db); > } > } > > > -- > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Android Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to android-developers+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.