Connection conn = null; Statement stmt = null; ResultSet rs = null; String membertype = "";//登录用户类型 try { StringBuffer sb = new StringBuffer(); sb.append(" select membertype from m_b_broker where brokerid='"+logonUser+"' "); System.out.print(sb); rs = stmt.executeQuery(sb.toString()); //这里报出空指针异常 System.out.print("1111"); while (rs.next()) { membertype=rs.getString("membertype"); } rs.close(); rs = null; stmt.close(); stmt = null; conn.close(); conn = null; } catch (Exception e) { e.printStackTrace(); } finally { try { if (rs != null) { rs.close(); rs = null; } if (stmt != null) { stmt.close(); stmt = null; } if (conn != null) { conn.close(); conn = null; } } catch (SQLException e) { e.printStackTrace(); } } return membertype;
添加回答
举报
0/150
提交
取消