title: Edit /Update entered data stored in database - servlet
body: <p>I have made a servlet file iin which I have added insertion, deletion and viewingthe data from database. </p>
  
  <p>Now I want to add updation of inserted data but I am not able to complete it. As I have added whole code in single file I dont know how to add it. can any one help me with it ??
  Waiting for reply.</p>
  
  <pre><code>        if(req.getParameter("choise")!=null)    {
              nm = req.getParameter("choise");
  
              idr = "UPDATE student SET rollno = ?, class = ?, mobileno = ? WHERE name ='"+nm+"'";
  
              try {
                  st=con.createStatement();
                  int rs1 = st.executeUpdate(idr);
                  pwinsert.println(rs1);
              }
              catch (Exception e) {
                  e.getMessage();
                  System.out.println("Error " +e);
              }
  
              System.out.println("Data Edited...");
  
          }
  </code></pre>