引起:android.database.sqlite.SQLiteException:near“text”:语法错误(代码1):,同时编译:创建表联系人(id整数主键,名称文本,电子邮件文本,uname文本,传递文本)
认为可能是这样,首先是间接问题,但似乎不是问题。这个登录/注册活动一直存在问题。
公共类DatabaseHelper扩展了SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "contacts.db";
private static final String TABLE_NAME = "contacts";
private static final String COLUMN_ID = "id";
private static final String COLUMN_NAME = "name";
private static final String COLUMN_EMAIL = "email";
private static final String COLUMN_UNAME = "uname";
private static final String COLUMN_PASS = "pass";
SQLiteDatabase db;
private static final String TABLE_CREATE ="create table contacts (id integer primary key , name text ," +
" email text , uname text , pass text ";
答案 0 :(得分:2)
您在)
结束时忘记了create table
。
您发布的异常没有该问题,并且SQL有效。错误消息指向sqlite引擎能够看到的最后一个有效令牌,即text
。