Home » Android » java – Adding variable to a sql statement isn't working-Exceptionshub

java – Adding variable to a sql statement isn't working-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

I want to add variables to my table in sql (android) but this is not working

articlesDatabase.execSQL("INSERT INTO articles VALUES(" + theId + "," + title + "," + url +  ")");
How to&Answers:

This is how it worked

articlesDatabase.execSQL("INSERT INTO articles Values (" + theId + ", '" + title + "', '" + url + "');");