How to make a search in a DB by String

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

How to make a search in a DB by String

Postby puxdroid » Thu Dec 17, 2009 2:03 pm

Hello

I'm trying to get a Content from a DB, but I'm want to get the information by a String instead of its id.

I have this code, but it doesn't work:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         public Cursor getsValue(String value) throws SQLException {
  3.  
  4.                 Cursor c = mDb.query(true, DATABASE_TABLE_SETTINGS,
  5.  
  6.                                 new String[] { "_id", "param", "value" }," value = '" + value +  "' ", null, null, null, null, null);
  7.  
  8.  
  9.  
  10.                 if (c != null) {
  11.  
  12.                         c.moveToFirst();
  13.  
  14.                 }
  15.  
  16.                 Log.d("hello", "" + c.getCount());
  17.  
  18.  
  19.  
  20.                 return mCursor;
  21.  
  22.  
  23.  
  24.         }
  25.  
  26.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


Always the c.getCount() give me 0, but it is not true.

Anybody knows how to solve this problem
puxdroid
Developer
Developer
 
Posts: 49
Joined: Wed Nov 25, 2009 11:57 am

Top

Re: How to make a search in a DB by String

Postby puxdroid » Fri Dec 18, 2009 3:06 pm

I have solved the problem.
This code works ok. ;)
puxdroid
Developer
Developer
 
Posts: 49
Joined: Wed Nov 25, 2009 11:57 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 1 guest