Processing ResultSet Objects
by , 03-10-2012 at 07:42 AM (538 Views)
Data that has been store in a ResultSet is accessed by a cursor. In ResultSet object, one row of data is pointed by the help of this cursor. In beginning, before 1st row the pointer gets positioned. Different methods are provided by the ResultSet objects so that to move the cursor.
Given code details the ResultSet object processing.
Java Code:try { stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String coffeeName = rs.getString("COF_NAME"); int supplierID = rs.getInt("SUP_ID"); float price = rs.getFloat("PRICE"); int sales = rs.getInt("SALES"); int total = rs.getInt("TOTAL"); System.out.println( coffeeName + "\t" + supplierID + "\t" + price + "\t" + sales + "\t" + total); }









Email Blog Entry
PDF to TIFF Conversion & Control...
05-24-2013, 11:39 AM in Java Software