Getting id of a row in SQLite in android

后端 未结 1 1066
梦谈多话
梦谈多话 2020-12-20 10:08

In my application I want to get the id of a particular row. I am using the following code:

public String getid(String  heading) throws SQLException
    {
            


        
相关标签:
1条回答
  • 2020-12-20 10:30

    Try this:

    Cursor mCursor = db.rawQuery(
                     "SELECT id  FROM  savedstoriestable WHERE heading= '"+heading+"'" , null);
    

    heading is a String. So you have to put it inside ''.

    0 讨论(0)
提交回复
热议问题