PreparedStatement ps = conn
问题描述:
PreparedStatement ps = conn
.prepareStatement("select * from today where username=?and year2=?and month2=?and day2=?");
ps.setString(1,username);
ps.setString(2,year2);
ps.setString(3,month2);
ps.setString(4,day2);
ResultSet rs = ps.executeQuery();
这个哪错了吗?
答
String sql = "SELECT userid,name FROM tuser WHERE userid=?AND password=?" ;pstmt = conn.prepareStatement(sql) ;pstmt.setString(1,userid) ; // 这里设置了第一个?的值pstmt.setString(2,password) ; // 这里...