Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - retrieving data from DB with query method

retrieving data from DB with query method

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

retrieving data from DB with query method

Postby droidmail » Tue May 06, 2008 10:02 pm

Hi

I\'m tryin to retrieve only one row from the data base so iuse the query method and i write this code but i have the following error: no such column, please who know how correct this code or please tell me how retrieve data with select ... from where....
note I use the m5 version of sdk
thinks a lot

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public Cursor fetchAccount2(String user) throws SQLException {
  2.  
  3.      Cursor result = mDb.query(true, DATABASE_TABLE, new String[] { KEY_ROWID, KEY_ACCOUNT, KEY_USER, KEY_PASSWORD, KEY_SMTPHOST, KEY_SMTPPORT, KEY_POPHOST, KEY_POPPORT}, KEY_USER + \"=user\", null,  null, null, null);
  4.  
  5.     if ((result.count() == 0) || !result.first()) {
  6.  
  7.          throw new SQLException(\"No user matching : \" + user);
  8.  
  9.     }
  10.  
  11.     return result;
  12.  
  13. }
Parsed in 0.011 seconds, using GeSHi 1.0.8.4
im student and im interesting with android
droidmail
Freshman
Freshman
 
Posts: 2
Joined: Tue May 06, 2008 9:23 pm
Location: france

Top

Postby cadlg » Tue May 06, 2008 10:34 pm

Hi droidmail,

I guess the problem is originated by your selection string

1) Try this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public Cursor fetchAccount2(String user) throws SQLException {
  2.  
  3.         Cursor result = mDb.query(true, DATABASE_TABLE, new String[] {
  4.  
  5.         KEY_ROWID,KEY_ACCOUNT, KEY_USER,KEY_PASSWORD,KEY_SMTPHOST,KEY_SMTPPORT,KEY_POPHOST,KEY_POPPORT}, KEY_USER+"="+ user,null, null,null, null);
  6.  
  7.         if ((result.count() == 0) || !result.first()) {
  8.  
  9.                 throw new SQLException("No user matching : " + user);
  10.  
  11.         }
  12.  
  13.         return result;
  14.  
  15. }
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


2) Ensure that all of the constants match the table and column names as defined in your create method

Regards,

cadlg
cadlg
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Feb 20, 2008 12:33 am
Location: Guatemala

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests