android - multiple where clause failed - assigning same string for different column values -


in code there function retrieve rows in countdesc= inputtext , countdate= datevalue. both countdesc , countdate getting assigned edittext .the logcat given here.please me find error.

public cursor fetcheventbyname(string inputtext,string datevalue ) throws sqlexception {         sqlitedatabase db = this.getreadabledatabase();          cursor mcursor = null;         if (inputtext == null || inputtext.length () == 0) {         mcursor = db.query(database_table, new string[] {key_rowid,                 key_desc, key_date, key_event },         null, null, null, null, null);         }         else {               mcursor= db.rawquery("select * <countable>  countdesc='" + inputtext + "' , countdate='" + datevalue+ "'", null);         }          if (mcursor != null) {         mcursor.movetofirst();         }         return mcursor;    } 

logcat

08-16 06:28:11.730: e/androidruntime(2673): java.lang.runtimeexception: unable start activity componentinfo{example.events1/example.events1.getclicker}: android.database.sqlite.sqliteexception: near "<": syntax error (code 1): , while compiling: select * <countable>  countdesc='yalahanka' , countdate='yalahanka' 

try below code:

    sqlitedatabase db=openorcreatedatabase("mydb", mode_private, null);     string table="mytbl";     string whereclause = "number = ? , name = ?";     string[] whereargs = new string[] { strnum };  whereargs[1] = new string[] { strnname };     db.delete(table, whereclause, whereargs);     db.close(); 

in above code, i'm deleting entries multiple clause.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -