根据以下代码:
char Secgrp = 0;
try{
String a = (String) comboName.getSelectedItem();
String fill = "Select recDate, attendant, grp from log order by id DESC";
ps = conn.prepareStatement(fill);
rs = ps.executeQuery();
String x = cDate();
while (rs.next()){
java.sql.Date dDate = rs.getDate("recDate");
String bName = rs.getString("attendant");
char[] cbuf = new char[1];
rs.getCharacterStream("grp").read(cbuf);
char theValue = cbuf[0];
String grp = Character.toString(theValue);
if(x.equals(dDate.toString()) && group1 == theValue && a.equals(bName)){
Secgrp = theValue++ ;
}
else if(x.equals(dDate.toString()) && theValue > group1 && a.equals(bName))
{ Secgrp = theValue++;
}
else if(x.equals(dDate.toString()) && group1 > theValue && a.equals(bName))
{ Secgrp = group1;
}
根据上面的代码,我正在尝试检查 char 是否等于我的结果集记录。例如,如果 A 等于 A,如果 date = date 和 name = name 则比做某事。
但是当我 setText(String.valueOf(Secgrp)) 时,没有插入任何字符。
请建议我如何从结果集中检索一个字符,例如“A”。