나는 다음과 같은 DB 헬퍼 클래스가 있습니다SQLite는 예외 선택하려고 그런 열
public int studentExists(String studid) {
Cursor dataCount = mDb.rawQuery("select count(*) from usertable where " + KEY_STUDID + "=" + studid, null);
dataCount.moveToFirst();
int count = dataCount.getInt(0);
dataCount.close();
return count;
}
나는 학생 ID가 이전에 입력되어 있는지 확인하기 위해 내 응용 프로그램이 사용합니다.
학생 ID가 int 일 때 제대로 작동하지만 (346742) 영숫자 ID (PB3874)를 추가 할 때마다 앱이 강제 종료됩니다.
오류 :
private static final String DATABASE_CREATE =
"create table usertable (_id integer primary key autoincrement, "
+ "studid text not null);";
그러나 오류가 no such column: pb3874
말을 왜 내가 혼란 스러워요 : (I 텍스트 형식을 사용하기 때문에)
06-13 18:22:20.554: ERROR/AndroidRuntime(8088): android.database.sqlite.SQLiteException: no such column: pb3874: , while compiling: select count(*) from usertable where studid=pb3874
내가 그에게 데이터 형식의 문제를 생각하지 않는다 나는 단순히 그 칼럼에서 그 가치를 선택하려고 노력하고 있습니다. 또한 왜 이것이 int 값을 위해 완벽하게 작동하는지. 누구든지 문제를 해결하는 데 문제가 있습니까?
가능한 복제 [SQLite는 삽입 문제 - 오류 : 그런 칼럼] (https://stackoverflow.com/questions/21958789/sqlite-insert-issue-error-no-such-column) – Veve