I'm working on a project where I need to set a database for users to use my application on android, for this I created two activities: One that will create a user (signUp activity) and another activity that will allow the Sign In part... My issue is, that when I compair the String value I collected from my EditText view to the Column (user_name) which content datatype is (Text) in my db, I have an error that ignores completely what comes after my select ...where ... = Here is the code, Hopefully someone knows this issue.
name = (EditText) findViewById(R.id.user_name);
final String verify = name.getText().toString().trim();
Cursor cs = db1.rawQuery("select * from user where name_user="+verify,null);
After these instruction I used an 'If' statement that shows a toast whenever the name of the user already exists or not, I tried to surround my code with try catch, but that simply ignores the error, and in my table, we insert an empty user name... here is the error:
android.database.sqlite.SQLiteException: near "=": syntax error (code1):while compiling: select * from user where name_user=
I know that my problem is the (verify) variable, but I don't know how to make the String value, a text value so that my sqlite command is accepted Thank you in advance for answering.