logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 01-18-2008, 12:13 PM   #1
sher_amf
 
Join Date: Nov 2007
Posts: 20
Default sql add at the same time delete

what i want is that everytime i add something to my sell table the stocks table deletes
Code:
<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 is offline   Reply With Quote
Old 01-20-2008, 06:47 AM   #2
sher_amf
 
Join Date: Nov 2007
Posts: 20
Default

any updates?
sher_amf is offline   Reply With Quote
Old 01-20-2008, 07:27 AM   #3
sher_amf
 
Join Date: Nov 2007
Posts: 20
Default

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...elete.zip.html
sher_amf is offline   Reply With Quote
Old 01-20-2008, 11:11 AM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

we dont have anybody on this forum who uses JSP

sorry
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 01-20-2008, 04:09 PM   #5
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

90% are lurkers, so wait a few days for a response.
domedia is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:49 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com