mercredi 27 mai 2015

Select variable with SQLite in Java

At the moment I have a table that look like this:

ID       VAR1   VAR2
SN453    1      blablabla
SN453    2      blablabla
AK221    1      blablabla
AK221    2      blablabla

What I want to do is to select VAR1 and VAR2 for a given ID. ID is in a String variable, I would use this:

ps = connect.prepareStatement("SELECT VAR1, VAR2 FROM TABLE1 WHERE ID = ?");

How can I tell SQLite to pick the ID value from my string variable?

Aucun commentaire:

Enregistrer un commentaire