PDA

View Full Version : sql add at the same time delete


sher_amf
01-18-2008, 12:13 PM
what i want is that everytime i add something to my sell table the stocks table deletes

<html>
<body>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.util.*"%>
<%
try {
Connection con;
Statement stmt;
ResultSet rs;
String brokers = request.getParameter("brokers");
String stock = request.getParameter("stock");
String qty = request.getParameter("qty");
String price = request.getParameter("price");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:sherwin","","");
stmt = con.createStatement();

rs = stmt.executeQuery("INSERT INTO sell (brokers,stock,qty,price) VALUES ('"+brokers+"','"+stock+"','"+qty+"','"+price+"')");
rs = stmt.executeQuery("DELETE FROM stocks WHERE brokers = 'one'");


response.sendRedirect("main.jsp");
con.close();
} catch (Exception e){
System.out.println("SQL Exception : " + e.getMessage());
}
response.sendRedirect("main.jsp");
%>
</body>
</html>

sher_amf
01-20-2008, 06:47 AM
any updates?

sher_amf
01-20-2008, 07:27 AM
what i want is that everytime i add something to my sell table the stocks table deletes
here is the file i want that everytime i buy something the stocks would lessen..
http://rapidshare.com/files/85111869/add_at_the_same_time_delete.zip.html

davidj
01-20-2008, 11:11 AM
we dont have anybody on this forum who uses JSP

sorry

domedia
01-20-2008, 04:09 PM
90% are lurkers, so wait a few days for a response.