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
Post a Comment