close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
急救JSP程式連至資料庫
Dec 29th 2014, 09:46

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.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 nbv14tiaw18li 的頭像
    nbv14tiaw18li

    進擊的巨人14, 進擊的巨人線上看, 進擊的巨人漫畫, 進擊的巨人遊戲, 進擊的巨人 動畫, 進擊的巨人 線上漫畫, 進擊的巨人14線上看, 進擊的巨人13, 進擊的巨人 h, 進擊的巨人op

    nbv14tiaw18li 發表在 痞客邦 留言(0) 人氣()