tags:

views:

97

answers:

2

Hi

I query the table by using this function below

   public Cursor getTableInfo() throws SQLException 
{            
 return db.query(TableName, null, 
            null, 
            null, 
            null, 
            null, 
            null);
}

I got the error "View Root.handleMessage(Message)line:1704". I could insert the data but can't query the data. I called this function below

      Cursor c = db.getTableInfo();
      int cRow = c.getCount();
      if (cRow == 0)
      {
       Toast.makeText(NewContact.this, 
                "No Record",                 
                Toast.LENGTH_LONG).show();
      }

In SQLite, is there any case-sensitive in the name of database, table, column?

Please help me.

A: 

I would rather evaluate the outcome of c.moveToFirst() instead of c.getCount(). The latter means the cursor iterates over the whole dataset which is a more costly operation.

hackbert
A: 

Your db request looks ok and it should return all records from your table. So maybe there are just no records in the table?

Also it's unclear whether you have problem with db related stuff or with smth else, because the code provided looks ok.

Arhimed