代碼如下:public int voteUser(voteUser vv) throws SQLException// 在表voteUser中查找該用戶是否在 某一voteid中已投過票{getConnection db=new getConnection();String sql="select * from voteUser where voteId='"+vv.getVoteId()+"' and userName='"+vv.getUserName()+"'";System.out.println(sql);int aa=0;ResultSet ss=db.select(sql);ss.last();if(ss.getRow()==0){aa=1;System.out.println("voteDaozhong 該用戶名是否存在"+aa);}else{aa=0;System.out.println("voteDaozhong 該用戶名是否存在"+aa);}db.close();return aa;}getConnection 128行附近代碼如下public ResultSet select(String sql) {ResultSet rs = null;try {rs=st.executeQuery(sql);} catch (SQLException e) {e.printStackTrace();}return rs;}錯誤提示如下:這個函數的目的是查看數據庫表中是否存在相應的記錄, 入股存在則返回1,不存在則返回0
添加回答
舉報
0/150
提交
取消