no such column error in android database -


when perfom search method given me run time error

error:- 05-04 14:04:00.227: e/androidruntime(4559): caused by:  android.database.sqlite.sqliteexception: no such column: ww (code 1): ,  while compiling: select distinct faculty, deparment, name, officenumber,  phonenumber, emailaddress, officehour teacherinfo name=ww 

i need search on teacher name when user enter name , display information teacher such name ,faculty,deparment,phone,email,officenumber,officehour

thiss getrecord method in dbadapter.java

public cursor getrecord(string n1) throws sqlexception  {            cursor mcursor =db.query(true,tablename , new string[] {facultyc,                 deparmentc, namec, officenumberc,phonec ,emailaddressc,officehourc},namec + "=" + n1, null, null, null, null, null);       if (mcursor != null) {         mcursor.movetofirst();     }     return mcursor; } 

and search method in information.java

public void search(){     db.open();     cursor c = db.getrecord(n);     if (c.movetofirst()){         t1.settext(c.getstring(0));         t2.settext(c.getstring(1));         t3.settext(c.getstring(2));         t4.settext(c.getstring(3));         t5.settext(c.getstring(4));         t6.settext(c.getstring(5));         t7.settext(c.getstring(6));      }      else         toast.maketext(this, "this dr not found", toast.length_long).show();     db.close(); } 

this oncreate method in dbadapter.java

public void oncreate(sqlitedatabase db)  database_create =         "create table if not exists teacherinfo (teachernumber integer primary key autoincrement,"          + "name text not null, faculty text,deparment text,officenumber integer,officehour text, emailaddress text,phonenumber text, location integer );";             {                 try {                     db.execsql(database_create);                     } catch (sqlexception e) {                     e.printstacktrace();                 }             } 

cursor mcursor =db.query(true,tablename , new string[] {facultyc,             deparmentc, namec, officenumberc,phonec ,emailaddressc,officehourc},namec + "= ?", new string[] { n1 }, null, null, null, null); 

strings have in quotes.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -