...

View Full Version : help with these



sher_amf
01-18-2008, 06:46 AM
<html>
<body>

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

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

rs = stmt.executeQuery("INSERT INTO stocks (broker,stock,value,qty) VALUES ('"+broker+"','"+stock+"','"+value+"','"+qty+"'));

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

</body>
</html>




whats wrong with that?

shyam
01-18-2008, 10:18 AM
rs = stmt.executeQuery("INSERT INTO stocks (broker,stock,value,qty) VALUES ('"+broker+"','"+stock+"','"+value+"','"+qty+"'));
whats wrong with that?

u've not closed the final double-quote !!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum