关于数据库添加语句问题

huxinxinxin huxinxinxin 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Connection conn = DB.getconn();
String sql="insert into articles values (null,?,?,?,?,now(),?)";
PreparedStatement pstmt = DB.prepareStmt(conn, sql);
pstmt.setInt(1,"pid");
pstmt.setInt(2,"rootid");
pstmt.setString(3,"title");
pstmt.setString(4,"cont");
pstmt.setInt(5,0);
pstmt.excuteUpdate();
DB.close(pstmt);
DB.close(conn);
总是报这样的错误,
An error occurred at line: 16 in the jsp file: /replyDeal.jsp
Connection cannot be resolved to a type
13: String title=request.getParameter("title");
14: System.out.println("title");
15: String cont=request.getParameter("cont");
16: Connection conn = DB.getconn();
17: String sql="insert into articles values (null,?,?,?,?,now(),?)";
18: PreparedStatement pstmt = DB.prepareStmt(conn, sql);
19: pstmt.setInt(1,"pid");


An error occurred at line: 18 in the jsp file: /replyDeal.jsp
PreparedStatement cannot be resolved to a type
15: String cont=request.getParameter("cont");
16: Connection conn = DB.getconn();
17: String sql="insert into articles values (null,?,?,?,?,now(),?)";
18: PreparedStatement pstmt = DB.prepareStmt(conn, sql);
19: pstmt.setInt(1,"pid");
20: pstmt.setInt(2,"rootid");
21: pstmt.setString(3,"title");
唉,我菜鸟,求高手解答啊
...全文
评论 1
收藏 已收藏
分享
返回顶部
huxinxinxin
其他 10,610 成员 29,026 内容