c# - LIKE command Mysql -


can tell me wrong command? error. use c# , mysql database.

 public static dataset getinstructorlistsearchemail(string instemail)         {             db.connecttodb();             db.dbopen();          dataset ds = new dataset();         try         {             string comtext = "select * instructor instructor_email %instemail";             mysqlcommand com = new mysqlcommand(comtext, db.conn);             com.parameters.add("instemail", mysqldbtype.varchar, 200).value = instemail;             mysqldataadapter adapter = new mysqldataadapter(com);             adapter.fill(ds); 

seeing used cmd parameter need modify query string accept parameters changing

string comtext = "select * instructor instructor_email @instemail"; com.parameters.addwithvalue("@instemail", "%" + instemail); 

or work using single quotes , drop parameter think using parameters better.

string comtext = "select * instructor instructor_email '%" + instemail + "'"; 

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 -