I'm making a data storage application with Android Studio sqlite If you press the input and fix button, the application will end I posted a question here and they told me to check the log.
So I checked the log and solved the input button I haven't solved the correction button yetㅜ<
btnUpdate.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
db = dbHelper.getWritableDatabase();
if (edtName.getText().toString() != "") {
db.execSQL("UPDATE groupTBL SET gNumber = '"
+ + edtNumber.getText() + "', WHERE gName = '"
+ + edtName.getText().toString() +
"' "' WHERE gSerName = '"
+ + edtSerName.getText().toString() +"';");
}
db.close();
Toast.makeText(getApplicationContext(), "Modified",
Toast.LENGTH_SHORT).show();
btnSelect.callOnClick();
}
});
In this part android.database.sqlite.SQLiteException: near "WHERE": syntax error (code 1): , while compiling: UPDATE groupTBL SET gNumber = 'wg160705!', WHEREgName = 'id5656' WHERE gSERName = 'Naver';
The log(?) appears like this, so how should I solve it? It's my first time playing a video, so I'm lacking a lotㅠ<
sqlite
I think we can change the "WHEREgSerName="
part to "AND WHEREgSerName="
"?
Learn about the SQLite where AND operator.
© 2024 OneMinuteCode. All rights reserved.