我在android中创建了这个表:
String CREATE_TABLE="CREATE TABLE " + db_NAME + " ("
+ row_ID + " INT PRIMARY KEY AUTOINCREMENT,"
+ row_NAME + " TEXT, "
+ row_EMAIL + " TEXT, "
+ row_WEBSITE + " TEXT, "
+ row_TELEPHONE1 + " TEXT, "
+ row_TELEPHONE2 + " TEXT, "
+ row_TELEPHONE3 + " TEXT, "
+ row_TELEPHONE4 + " TEXT, "
+ row_TELEPHONE5 + " TEXT;";
db_name.execSQL(CREATE_TABLE);
我正在尝试插入以下数据:
姓名:阿拉姆·侯赛因
电子邮件:ahlam@ahlam.ahlam
网址:www.ahlam.com
电话#1:123456789
电话#2:0987654321
电话#3:
电话#4:
电话#5:
使用以下字符串:
String sql_entry = String.format("Insert into %s (%s, %s, %s, %s, %s, %s, %s, %s) values (%s, %s, %s, %s, %s, %s, %s, %s);",tab_NAME, row_NAME, row_EMAIL, row_WEBSITE, row_TELEPHONE1, row_TELEPHONE2, row_TELEPHONE3, row_TELEPHONE4, row_TELEPHONE5, name, email, website, telephone1, telephone2, telephone3,telephone4, telephone5);
ourDatabase.execSQL(sql_entry);
其中:( row_NAME, row_EMAIL, row_WEBSITE, row_TELEPHONE1, row_TELEPHONE2, row_TELEPHONE3, row_TELEPHONE4, row_TELEPHONE5)
是列名'
和 :(name, email, website, telephone1, telephone2, telephone3,telephone4, telephone5)
是要插入数据库的数据
当我运行应用程序时,我收到一条错误消息:
SQLiteLog (1) near "M" : syntax error
那么问题是什么???