我有用户信息表,需要获取用户密码和用户用户名查询:
Cursor cursor = db.rawQuery("select "+User.COL_NAME +User.COL_PASS +" from " + User.TABLE_NAME+" WHERE "+User.COL_NAME+ User.COL_PASS +"=?", new String[]{UserName , PassWord});
但我不能这样做,错误消息是:
Caused by: android.database.sqlite.SQLiteException: no such column: UserNamePassword (code 1): , while compiling: select UserNamePassword from users WHERE UserNamePassword=?
这是我的代码
public String getUserByUserAndPassword(String UserName , String PassWord) {
String All_info="" ;
Cursor cursor = db.rawQuery("select "+User.COL_NAME +User.COL_PASS +" from " + User.TABLE_NAME+" WHERE "+User.COL_NAME+ User.COL_PASS +"=?", new String[]{UserName , PassWord});
while (cursor.moveToNext()) {
String user_1 = cursor.getString(cursor.getColumnIndex(User.COL_NAME));
String pass_1 = cursor.getString(cursor.getColumnIndex(User.COL_PASS));
All_info= user_1+"/"+pass_1;
}
cursor.close();
return All_info ;}
引起原因:android.database.sqlite.SQLiteException:没有这样的列:UserNamePassword(代码1):,编译时:从用户中选择UserNamePassword WHERE UserNamePassword=?
杨__羊羊
肥皂起泡泡
吃鸡游戏
相关分类