小编lev*_*ali的帖子

android.database.sqlite.SQLiteException:没有这样的表:users_table(代码1):,同时编译:INSERT INTO users_table

所以我看到并阅读了所有相同的问题,试图解决问题,但我没有找到正确的答案.我试图修改VERSION NUMBER,运行应用程序,但我有错误.之后我从手机中删除了应用程序,将VERSION NUMBER更改为1,再次运行应用程序...同样的错误.

这是我的代码:

   MySQLite sql; 
Context context; 

public MySQLiteAdapter(Context context) { //constructor 
sql = new MySQLite(context); 
this.context=context; 
} 

public long insertUser(String Username,String Pass, String Name, String Mail){ 
SQLiteDatabase db=sql.getWritableDatabase(); 

ContentValues cv=new ContentValues(); 

cv.put(MySQLite.COLUMN_USERNAME,Username); 
cv.put(MySQLite.COLUMN_PASSWORD,Pass); 
cv.put(MySQLite.COLUMN_REALNAME,Name); 
cv.put(MySQLite.COLUMN_MAIL,Mail); 

long id=db.insert(MySQLite.TABLE_USERS,null,cv); 
return id; 
} 

class MySQLite extends SQLiteOpenHelper { 

private static final String DATABASE_NAME = "APPLICATION"; //name database 

private static final int DATABASE_VERSION = 1; 

public static final String TABLE_USERS="users_table"; 
public static final String COLUMN_ID = "_id"; 

public static final String COLUMN_USERNAME="USERNAME"; …
Run Code Online (Sandbox Code Playgroud)

sqlite android

0
推荐指数
1
解决办法
8109
查看次数

标签 统计

android ×1

sqlite ×1