use*_*694 0 java eclipse sqlite android
我正在创建一个应用程序,用于将EditText中的输入字符串值输入到SQLite数据库中.通过模拟器运行应用程序时,最初创建数据库时会收到logcat错误消息.logcat错误消息如下.
01-23 16:47:39.613:E /数据库(1386):0x1392b8上的失败1(接近"existinfoTable":语法错误)准备'如果不存在则创建表infoinfo(_idinterger主键,sNametext不为空,wUrltext不为null, uNametext not null,pWordtext not null);'.
它所指的OnCreate方法如下.我不确定导致问题的语法错误.任何帮助,将不胜感激.
public void onCreate(SQLiteDatabase db) {
String sqlDataStore = "create table if not exist" +
TABLE_NAME_INFOTABLE + "("+ BaseColumns._ID + "interger primary key autoincrement,"
+ COLUMN_NAME_SITE + "text not null,"
+ COLUMN_NAME_ADDRESS + "text not null,"
+ COLUMN_NAME_USERNAME + "text not null,"
+ COLUMN_NAME_PASSWORD + "text not null),";
db.execSQL(sqlDataStore);
}
Run Code Online (Sandbox Code Playgroud)
teh*_*ess 10
从它的外观来看,你拼错了'整数',看起来你需要在'整数'之前,在'存在'之后需要一个空格(我认为它应该是'存在')和'''之前.所以....
String sqlDataStore = "create table if not exists " +
TABLE_NAME_INFOTABLE + " ("+ BaseColumns._ID + " integer primary key autoincrement,"
+ COLUMN_NAME_SITE + "text not null,"
+ COLUMN_NAME_ADDRESS + "text not null,"
+ COLUMN_NAME_USERNAME + "text not null,"
+ COLUMN_NAME_PASSWORD + "text not null)";
Run Code Online (Sandbox Code Playgroud)
你也可以省略','或';' 在声明的最后.
| 归档时间: |
|
| 查看次数: |
7041 次 |
| 最近记录: |