jQuery in Action, 2nd edition*
The moose likes EJB and other Java EE Technologies and the fly likes problem to get integer value in MSAccess please help.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "problem to get integer value in MSAccess please help.." Watch "problem to get integer value in MSAccess please help.." New topic
Author

problem to get integer value in MSAccess please help..

Rohan Patel
Greenhorn

Joined: Jun 13, 2011
Posts: 4
try {

//String a=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbcdbc:newtest");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from department");
while (rs.next()) {
department.Deptbean u1 = new department.Deptbean();
// a=rs.getString(1);
u1.setDept_id(rs.getString(1));
u1.setName(rs.getString(2));//Problem in this statement
//cant get integet value & rs.getInt() not working

listd.add(u1);
System.out.println("Prob"+rs.getString(1));
}

} catch (Exception ex) {
System.out.println("Prob:"+ex.toString());






Exception is
Prob:java.sql.SQLException: No data found
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem to get integer value in MSAccess please help..