代碼如下:public int voteUser(voteUser vv) throws SQLException// 在表voteUser中查找該用戶是否在 某一voteid中已投過(guò)票{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;}錯(cuò)誤提示如下:這個(gè)函數(shù)的目的是查看數(shù)據(jù)庫(kù)表中是否存在相應(yīng)的記錄, 入股存在則返回1,不存在則返回0
本人技術(shù)渣,寫成現(xiàn)在這樣,這個(gè)問題困擾了我好幾個(gè)小時(shí)了,各位大神,看看是哪里出錯(cuò)了
狐的傳說(shuō)
2023-01-03 15:11:04