如何让JComboBox显示HashSet的内容?
尝试{
class . forname(" sun . JDBC . odbc . JDBC odbc driver ");
string URL = " JDBC:odbc:stu ";
connection conn = driver manager . get connection(URL);
statement stat = conn . create statement();
string SQL = " select * from students where xuehao = ' "+xhjcombobox . getselecteditem()。toString()+" ' ";
ResultSet rSet = stat . execute query(SQL);
resultset metadata data = rset . get metadata();
rset . next();
xuehaojtextfield . settext(rset . getstring(1));
xingmingjtextfield . settext(rset . getstring(2));
//xingbiejcombobox . setselectedindex(1);
xingbiejcombobox . setselecteditem(rset . getstring(3));
nianlingjtextfield . settext(rset . getstring(4));
banji combobox . setselectedindex(bjjcombobox . getselectedindex());
dianhuajtextfield . settext(rset . getstring(6));
zhuzijtextfield . settext(rset . getstring(7));
rset . close();
}
catch(java.lang.Exception执行)
{
Joption窗格。显示消息对话框(空,“查询学生信息出错”,“提示信息”,JOptionPane。PLAIN _ MESSAGE);
}
bjjcombobox . request focus();
}//GEN-LAST:event _ jbutton 1 action performed