(1)在" existsUserInformation& quot附近:语法错误

编程入门 行业动态 更新时间:2024-10-26 02:31:30
本文介绍了(1)在" existsUserInformation& quot附近:语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 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"附近:语法错误"

I am executing this code to store my data in SQLite database built in Android phones. When I am executing my code, I am getting an error message that is "(1) near "existsUserInformation": syntax error"

请帮助我.

推荐答案

您在字符串连接中缺少空格:

You are missing a space in your string concatenation:

"create table if not exists" + TABLE_NAME_USERSINFO

产生字符串

"create table if not existsUserInformation".

在存在后添加一个空格:

Just add a space after exists:

"create table if not exists " + TABLE_NAME_USERINFO.

声明的结尾处还有一个逗号.

You also have an extra comma at the end of your statement.

更多推荐

(1)在" existsUserInformation& quot附近:语法错误

本文发布于:2023-10-22 22:56:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1518979.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语法错误   amp   quot   existsUserInformation

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!