java - How to store the value of resultset as an int? -
i need open div tag jsp if value of resultset more 30000. how store value of rs int?
try { class.forname("com.ibm.db2.jcc.db2driver"); con = drivermanager.getconnection (urlprefix, "uname", "pwd"); system.out.println("got connection"); stmt = con.createstatement(); string strquery = "select count(*) tablename condition stmt"; rs = stmt.executequery(strquery); if (rs>30000) { request.getparameter("view"); } system.out.println("executed query"); } catch(exception e) { system.out.println(e); }
rs = stmt.executequery(strquery);
stmt.executequery return resultset object , object can retrive result of query below case.
rs = stmt.executequery(strquery); int count=0; if(rs.next()){ count=rs.getint(1); }
Comments
Post a Comment