sachinkore 0 Newbie Poster

k..but how to write a insert query..
In my project...see below

<%
 	try
	{
	 
	 ResultSet rs=null;
	 Connection con=null;
	 PreparedStatement st=null;
	 Class.forName("org.gjt.mm.mysql.Driver").newInstance();
	 	con = DriverManager.getConnection("jdbc:mysql://localhost/enrollment","root","root1");
		st=con.prepareStatement("select f.tot,f.fcid from formcollection f where f.employername='"+empID+"'and f.flag=0"); 
		rs=st.executeQuery();
				
		
		%>
		<table width="713" border="1">
        <tr>
          <th width="93" scope="row">Total Form Collected </th>
          <td width="70"><strong>DE Done </strong></td>
          <td width="72"><strong>Rejected</strong></td>
          <td width="86"><strong>Total DE Completed </strong></td>
          <td width="67"><strong>Batch Number </strong></td>
          <td width="285"><strong>Remark</strong></td>
        </tr>
        <% 
	
		while(rs.next())
		  { %>
	   
		<tr>
		 <input  name="srn" type="hidden" value="<%=rs.getInt(2)%>">
          <th scope="row"><%=rs.getInt(1)%></th>
          <td><input name="DE_Done" type="text" id="DE_Done" size="10" onChange="calc()"></td>
          <td><input name="Rejected" type="text" id="Rejected" size="10" onChange="calc()"></td>
          <td><input name="Tot_DE_Completed" type="text" id="Tot_DE_Completed" size="10" onChange="calc()"></td>
          <td><input name="Batch_Num" type="text" id="Batch_Num" size="10" ></td>
          <td><textarea name="Remark" id="Remark"></textarea></td>
        </tr>
	    	
	    <% } %>
        </table>
      <%}	
catch(Exception e)
           {
        	 out.println(e);
           }
		   
%>

iam using while loop to print all records..and with each record iam printing four textboxes...the value of 'Total Form Collected' displayed from DB (MySQL)..now i want insert these data into database..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.