开发者

SQLite Query in Android Application [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonab开发者_StackOverflowly answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

I need a sample code to fetch data from sqlite in android application.

  1. 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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜