The error I'm getting is SQLiteException: near ",": syntax error (code 1), and I cant figure where my mistake is.
I´ve read some other questions with the same error and the answer they give is that it's a simple syntax error with a missing comma. However I've checked again and that doesn't seem to be my problem. I've included the code below.
public static final String prospectos="RegProspectos.db";
public static final int dbversion = 1;
public static final String tabla_prospectos="prospectos";
public static final String cm_NomProspec="NomProspec";
public static final String cm_ApProspec="ApProspec";
public static final String cm_AmProspec="AmProspec";
public static final String cm_RfcProspec="RfcProspec";
public static final String cm_TelCasa="TelCasa";
public static final String cm_TelOficina="TelOficina";
public adminProspec(Context context)
{super(context,prospectos, null, dbversion);}
@Override
public void onCreate(SQLiteDatabase db) {
final String crea_tabla=
"CREATE TABLE "+tabla_prospectos+"("
+cm_NomProspec+ " TEXT,"
+cm_ApProspec+ " TEXT,"
+cm_AmProspec+ " TEXT,"
+cm_RfcProspec + " TEXT,"
+cm_TelCasa+ " TEXT,"
+cm_TelOficina+ " TEXT,"
+cm_UsrActReg+ " TEXT "+")";
db.execSQL(crea_tabla); }
Here is my logcat output:
06-30 11:15:18.083: E/SQLiteDatabase(1867): Error inserting = escobedo=escobedo gurrola=gurrola cesar=cesar Guec=Guec
06-30 11:15:18.083: E/SQLiteDatabase(1867): android.database.sqlite.SQLiteException: near ",": syntax error (code 1): , while compiling: INSERT INTO prospectos(,escobedo,gurrola,cesar,Guec) VALUES (?,?,?,?,?)
06-30 11:15:18.083: E/SQLiteDatabase(1867): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
06-30 11:15:18.083: E/SQLiteDatabase(1867): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
INSERT INTO prospectos(,escobedo,gurrola,cesar,Guec) VALUES (?,?,?,?,?)You forgot to add the first field name. Here:(,escobedo. No, wait. You completely messed the insert: you are inserting the VALUES where the FIELD LIST has to (optionally) go. The VALUES are those funny ? you have in the insert. And must be passed using a String array.altoProspecto.