java - Delete function using jsp and servlet -


hi can me figure out silly mistake. trying find out in internet couldnot find best solution. have jsp , java controller should able delete record databas, following code. acknowledge

public void dodel(httpservletrequest request, httpservletresponse response) throws classnotfoundexception, instantiationexception, illegalaccessexception{          try {                 httpsession session = request.getsession(true);                 messagebean mbean = new messagebean();                int id = mbean.getmesid();                string sql;                sql = "delete * message id =?";                class.forname(driver).newinstance();                 conn = drivermanager.getconnection(url);                 st = conn.createstatement();                 ps = conn.preparestatement(sql);                 ps.setint(1, id);                 ps.executeupdate();                 conn.commit();                 conn.close(); 

there should no * after delete, it's delete from.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -