helper=new DBHelper(Intro.this,"Project",null,1);//db 삽입
db = helper.getReadableDatabase();
String id = userid.getText().toString();//일반 변수로 변환
String pw = userpw.getText().toString();
String db_id = null;//참조 db값
String db_pw = null;
//쿼리문 설정
Cursor c = db.rawQuery("SELECT * FROM mop", null);
//while문으로 역시 원하는값을 변수에 넣어줌
while (c.moveToNext()) {
db_id = c.getString(c.getColumnIndex("ID"));
db_pw = c.getString(c.getColumnIndex("PW"));
}
//그다음 조건문을 걸어줘서 조건에 부합하다면 성공 메세지와 함께 다음 화면으로 이동
if (id.equals(db_id) && pw.equals(db_pw)) {
Intent intent = new Intent(getApplicationContext()
, MainMenu.class);
startActivity(intent);
}
while에서 movetoNext()가 끝나면 마지막 row의 id,pw가 db_id,pw로
들어가는데 if문에서 어떻게 정상적으로 검증이 되는 로직이 궁금합니다.