public class DataBaseClass extends SQLiteOpenHelper {
public static final String DB_NAME = "USER DATA";
public static final int DB_VERSION = 1;
public static final String TABLE_NAME_USERSINFO = "UserInformation";
public static final String COLUMN_NAME_FIRSTNAME = "FirstNamestring";
public static final String COLUMN_NAME_LASTNAME = "LastNamestring";
public static final String COLUMN_NAME_ADD1 = "Add1string";
public static final String COLUMN_NAME_ADD2 = "Add2string";
public static final String COLUMN_NAME_SSNFRST ="SSnfirststring";
public static final String COLUMN_NAME_SSNLST = "SSnlaststring";
public static final String COLUMN_NAME_MOBNO = "ContactNostring";
public static final String COLUMN_NAME_EMAILID = "emailidstring";
public static final String COLUMN_NAME_DOB = "Dateofbirthstring";
public DataBaseClass(Context context) {
super(context, DB_NAME, null, DB_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
String sqlQueryToCreateUserInformation = "create table if not exists" + TABLE_NAME_USERSINFO +
"(" + BaseColumns._ID + "integer primary key autoincrement,"
+ COLUMN_NAME_FIRSTNAME + " text not null,"
+ COLUMN_NAME_LASTNAME + " text not null,"
+ COLUMN_NAME_ADD1 + " text not null,"
+ COLUMN_NAME_ADD2 + " text not null,"
+ COLUMN_NAME_SSNFRST + " text not null,"
+ COLUMN_NAME_SSNLST + " text not null,"
+ COLUMN_NAME_MOBNO + " text not null,"
+ COLUMN_NAME_EMAILID + " text not null,"
+ COLUMN_NAME_DOB + " text not null,"
+ ");";
db.execSQL(sqlQueryToCreateUserInformation);
}
public void insertForm(String FirstNmstring, String LastNmstring,
String Add1string ,String Add2string,String SSnfirststring,
String SSnlaststring, String ContactNostring, String emailidstring, String Dateofbirthstring) {
String sqlQueryToCreateUserInformation;
ContentValues cv=new ContentValues();
cv.put(COLUMN_NAME_FIRSTNAME,FirstNmstring);
cv.put(COLUMN_NAME_LASTNAME, LastNmstring);
cv.put(COLUMN_NAME_ADD1, Add1string);
cv.put(COLUMN_NAME_ADD2, Add2string);
cv.put(COLUMN_NAME_SSNFRST, SSnfirststring);
cv.put(COLUMN_NAME_SSNLST, SSnlaststring);
cv.put(COLUMN_NAME_MOBNO, ContactNostring);
cv.put(COLUMN_NAME_EMAILID, emailidstring);
cv.put(COLUMN_NAME_DOB, Dateofbirthstring);
getWritableDatabase().insert("USER DATA", null, cv);
}
我正在执行此代码以将我的数据存储在 Android 手机内置的 SQLite 数据库中。当我执行我的代码时,我收到一条错误消息,即“(1)靠近“existsUserInformation”:语法错误”
请帮我解决这个问题。