1 public static String getRoleIdByRoleName(String[] roles) throws SQLException{
2 String strRole="aa";
3 DataControl db=new DataControl();
4 for(int i=0;i<roles.length;i++){
5 String sql="select roleId from scopeManage_role where roleName='"+roles[i]+"'";
6 System.out.print(sql);
7 ResultSet rs1=db.getResultSet(sql);
8 System.out.print(rs1.getInt("roleId"));
9 }
10 return strRole;
11 }
错误信息:
java.sql.SQLExcep
tion: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the curre
nt cursor position.
2 String strRole="aa";
3 DataControl db=new DataControl();
4 for(int i=0;i<roles.length;i++){
5 String sql="select roleId from scopeManage_role where roleName='"+roles[i]+"'";
6 System.out.print(sql);
7 ResultSet rs1=db.getResultSet(sql);
8 System.out.print(rs1.getInt("roleId"));
9 }
10 return strRole;
11 }
错误信息:
java.sql.SQLExcep
tion: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the curre
nt cursor position.
数据库的jar包加载了,通过db.getResultSet(sql)可以执行其他SQL语句。
{
System.out.println(rs1.getInt("roleId"));
}
好象是这样吧?
rs1.next()
System.out.println(rs1.getInt("roleId"));
}
while(rs1.next()){
System.out.println(rs1.getInt("roleId"));
}