SQLite Query in Android Application [closed]
I need a sample code to fetch data from sqlite in android application.
- based on user id i need to display data in textview.
eg. if i give Id:1
i need to display the corresponding values in textview below.
Pls Help me with the code
Thanks in advance
Raghav Raajagopalan
String SQL = "SELECT [spalte] FROM [tabelle] WHERE [spalte] = [wert];
Cursor c = sqldriver.ExecQuery(SQL);
if(c != null){
if(c.getCount() > 0){
c.moveToFirst();
TextView.setText(c.getString(0));
}
}
c.close();
c=null;
...
public static Cursor ExecQuery(String SQL) {
Cursor c = null;
try{
c = myDB.rawQuery(SQL, null);
}catch(SQLException e){
GlobalVars.LastError = e.getMessage();
}
return c;
}
精彩评论