【发布时间】:2017-05-02 19:30:56
【问题描述】:
原因:android.database.sqlite.SQLiteException: near "text": syntax error (code 1): , while compile: create table contacts (id integer primary key , name text , email text , uname text , pass text )
起初认为可能是间距问题,但似乎不是问题。此登录/注册活动一直存在问题。
公共类 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 ";
【问题讨论】:
-
换句话说,你在问为什么你没有向我们展示的代码会抛出这个异常。这是一个非常难以回答的问题,您可能希望通过发布您的Minimal, Complete, and Verifiable example 代码和您的问题来使其更容易回答。
-
嘿抱歉,刚刚编辑了它,现在添加了正在创建的表,我相信这就是错误所在,如果不是我可以添加其余部分。