html檔+jsp檔 連結至資料庫 我怎樣才能將網頁的內容連到資料庫中?????
String JDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectDB="jdbc:odbc:myDB";
Class.forName(JDriver);
Connection con = DriverManager.getConnection(connectDB);
Statement stmt = con.createStatement();
request.setCharacterEncoding("big5");
String uid =session.getAttribute("name").toString();
String book = request.getParameter("book");
String man = request.getParameter("man");
String store = request.getParameter("store");
String time = request.getParameter("time");
String price = request.getParameter("price");
String num = request.getParameter("num");
String sql="INSERT INTO shopping VALUES ('"+uid+"','"+book+"','"+man+"','"+store+"','"+time+"','"+price+"','"+num+"','"+val+"','"+val1+"')";
stmt.executeUpdate(sql);
stmt.close();
con.close();
request.setCharacterEncoding("big5");
String val=request.getParameter("rad");
out.print("你選擇: "+ val);
String val1);
%>
An error occurred at line: 26 in the jsp file: /ord.jsp
val cannot be resolved
23: String num = request.getParameter("num");
24:
25:
26: String sql="INSERT INTO shopping VALUES ('"+uid+"','"+book+"','"+man+"','"+store+"','"+time+"','"+price+"','"+num+"','"+val+"','"+val1+"')";
27:
28: stmt.executeUpdate(sql);
29: stmt.close();
An error occurred at line: 26 in the jsp file: /ord.jsp
val1 cannot be resolved
23: String num = request.getParameter("num");
24:
25:
26: String sql="INSERT INTO shopping VALUES ('"+uid+"','"+book+"','"+man+"','"+store+"','"+time+"','"+price+"','"+num+"','"+val+"','"+val1+"')";
27:
28: stmt.executeUpdate(sql);
29: stmt.close();
This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.