lundi 9 novembre 2015

Assign value to a variable in a string query at run time

I have a string query which i will be getting at run time from the database. In the query i have a variable to which i need to assign the value at run time.

ex:

int id; String query = select * from table where var1 = id;

Now when i execute this query , it is not taking the id value instead it takes that also as a query string.

In ios we use %@ in place of id and assign the value at run time. Is there any alternative for that in android?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire