Pankaj Kushwaha
Pankaj Kushwaha

Reputation: 300

usage of select statement in sqlite

Cursor mCursor = mDb.query(true, CUSTOMER_TABLE_NAME, 
      new String[] {GENERIC_ID_KEY, ADDRESS_KEY, PHONE_KEY, EMAIL_KEY,CUSTOMER_NAME_KEY},
      GENERIC_ID_KEY + "=" + customerDbId, null,
      null, null, null, null);

How should I modify this command if GENERIC_ID_KEY and customerDbId is string. I tried using like in b/w but still negative results, n error is thrown.

Upvotes: 1

Views: 158

Answers (2)

Tugrul
Tugrul

Reputation: 1808

It's a cursor problem. Be sure curser is the first state before selection.

Upvotes: 0

Avi Kumar
Avi Kumar

Reputation: 4433

if customerDbId is a string type then place it in between quote

as

GENERIC_ID_KEY + "= '" + customerDbId + "'"

Upvotes: 1

Related Questions