jsp数据库查询语句问题
Class.forName(driver);Connectionconn=DriverManager.getConnection(url,userID,pwd);sql=...
Class.forName(driver);
Connection conn = DriverManager.getConnection(url,userID,pwd);
sql = "select courseName from course where courseId='100001";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while(!rs.next()){
coursename=rs.getString("courseName");
}
上述代码运行成功,可是courseName没被赋值,错哪了
courseId='100001' 打错了 展开
Connection conn = DriverManager.getConnection(url,userID,pwd);
sql = "select courseName from course where courseId='100001";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while(!rs.next()){
coursename=rs.getString("courseName");
}
上述代码运行成功,可是courseName没被赋值,错哪了
courseId='100001' 打错了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询