请问这段代码为什么会有错误!在线等待 你的 变量定义在 if 域里,我疑惑!大侠们请问,那些变量出了 if 域是不是就没有了? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 int total=0,selecta....=0;if(rs.next()){total=rs.getInt("selecta")+rs.getInt("selectb")+rs.getInt("selectc")+rs.getInt("selectd")+rs.getInt("selecte")+rs.getInt("selectf");selecta=(rs.getInt("selecta")/total)*100;selectb=(rs.getInt("selectb")/total)*100;selectc=(rs.getInt("selectc")/total)*100;selectd=(rs.getInt("selectd")/total)*100;selecte=(rs.getInt("selecte")/total)*100;selectf=(rs.getInt("selectf")/total)*100;}else{out.println("<script>alert('还没有人投票!');history.go(-1);</script>");} 感谢楼上的现在就只有selecta=(rs.getInt("selecta")/total)*100;这里有错了其它的都正确了但是只要selecta=(rs.getInt("selecta")/total)*100;就要报错错误是Exception Report:javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index 固定分组 批量插入 sturts1+Spring+Hibernate+Oracle运行出错 我刚刚接触java请大家指教 struts1.2的问题,急求帮助!!总是出现空指针异常~~ java插入操作返回主键 使用JDBC的Statement删除数据报错 上一篇和下一篇的连接地址 怎么清除工程的一些琐碎 哈哈,jrun,我好恨你哦 如何将链接中的值传递给serlvet中的函数 ※※关于表与表之间取数据的问题!真的很急呀!后悔当初数据库没好好看看! 求救,Filter编码
if(rs.next())
{
total=rs.getInt("selecta")+rs.getInt("selectb")+rs.getInt("selectc")+rs.getInt("selectd")+rs.getInt("selecte")+rs.getInt("selectf");selecta=(rs.getInt("selecta")/total)*100;
selectb=(rs.getInt("selectb")/total)*100;
selectc=(rs.getInt("selectc")/total)*100;
selectd=(rs.getInt("selectd")/total)*100;
selecte=(rs.getInt("selecte")/total)*100;
selectf=(rs.getInt("selectf")/total)*100;}else{out.println("<script>alert('还没有人投票!');history.go(-1);</script>");
}
但是只要selecta=(rs.getInt("selecta")/total)*100;就要报错
错误是
Exception Report:
javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index