JSP把数据库的两个值赋值给变量并且比较两个变量的值
Stringsql="select*fromsanswerwherexuehao='"+xuehao+"'andshijuanhao='"+shijuanhao+"'";...
String sql="select * from sanswer where xuehao='"+xuehao+"'and shijuanhao='"+shijuanhao+"'"; rs=sm.executeQuery(sql); while(rs!=null&&rs.next()){ snum=rs.getString("snum"); int textnum=rs.getInt("textnum"); String sselect=rs.getString("sselect"); String smultiple=rs.getString("smultiple"); String sblank=rs.getString("sblank"); String sessay=rs.getString("sessay"); } int a; if((sselect.trim().compareTo(rselect)==0)) { a=20; }在 if((sselect.trim().compareTo(rselect)==0))报错:Multiple annotations found at this line:- rselect cannot be resolved to a variable(rselect是和select一样得到的)
报的错:
Multiple annotations found at this line:
- rselect cannot be resolved to a
variable
if((sselect.trim().compareTo(rselect)==0)) 放在下面也是一样的错误 展开
报的错:
Multiple annotations found at this line:
- rselect cannot be resolved to a
variable
if((sselect.trim().compareTo(rselect)==0)) 放在下面也是一样的错误 展开
2个回答
展开全部
String sql="select * from sanswer where xuehao='"+xuehao+"'and shijuanhao='"+shijuanhao+"'"; rs=sm.executeQuery(sql);
while(rs!=null&&rs.next()){
snum=rs.getString("snum");
int textnum=rs.getInt("textnum");
String sselect=rs.getString("sselect");
String smultiple=rs.getString("smultiple");
String sblank=rs.getString("sblank");
String sessay=rs.getString("sessay");
}
int a;
if((sselect.trim().compareTo(rselect)==0))
{ a=20; }
在这段代码中我没有找到rselect这个变量
另外,sselect是一个局部变量
while(rs!=null&&rs.next()){
snum=rs.getString("snum");
int textnum=rs.getInt("textnum");
String sselect=rs.getString("sselect");
String smultiple=rs.getString("smultiple");
String sblank=rs.getString("sblank");
String sessay=rs.getString("sessay");
}
int a;
if((sselect.trim().compareTo(rselect)==0))
{ a=20; }
在这段代码中我没有找到rselect这个变量
另外,sselect是一个局部变量
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询