데이터베이스를 이용해 주소록을 만들려고 하는데
E/SQLiteLog: (1) no such column: asd
E/ERROR: android.database.sqlite.SQLiteException: no such column: asd (code 1 SQLITE_ERROR): , while compiling: insert into contactable(name, mobile) values (asd, 1512)
이런 오류가 납니다.
에뮬레이터에서 입력한 값인데 asd가 이름이고 숫자가 번호입니다.
테이블 생성 함수
database.execSQL("create table if not exists " + name + "("
+ " _id integer PRIMARY KEY autoincrement, "
+ " name text, "
+ " mobile text)");
삽입 함수(여기에서 에러가 나옵니다.)입니다.
private void insertRecord() {
println("insertRecord 호출됨.");
String input_name = editTextName.getText().toString();
String input_phone = editTextPhone.getText().toString();
try {
database.execSQL("insert into " + tableName
+ "(name, mobile) "
+ " values "
+ "(" + input_name + ", " + input_phone + ")");
println("레코드 추가함.");
}catch (Exception e) {
Log.e("ERROR", e.toString());
}
}