public float FindWowMoney(int useid) //查询魔兽世界剩余点卡
{
Connection conn=null;
PreparedStatement pstat=null;
ResultSet rs=null;
String sql=null;
float wowoney1=0;
try {
DB db=new DB();
conn=db.conn();
sql="select sum(cash) from cardpay where uid=? and gid=?";
pstat=conn.prepareStatement(sql);
pstat.setInt(1, useid);
pstat.setInt(2,1);
rs=pstat.executeQuery();
if(rs.next())
{
wowoney1=(rs.getFloat(3));//wow钱
}
rs.close();
pstat.close();
conn.close();
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return wowoney1;
}在页面这样写的float getcardwow=cardpay.FindWowMoney(getid); getid能得到值
但最后页面显示是0,控制台显示java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引
搞不懂了。。到底哪里错了呢?
急啊,在线等。
{
Connection conn=null;
PreparedStatement pstat=null;
ResultSet rs=null;
String sql=null;
float wowoney1=0;
try {
DB db=new DB();
conn=db.conn();
sql="select sum(cash) from cardpay where uid=? and gid=?";
pstat=conn.prepareStatement(sql);
pstat.setInt(1, useid);
pstat.setInt(2,1);
rs=pstat.executeQuery();
if(rs.next())
{
wowoney1=(rs.getFloat(3));//wow钱
}
rs.close();
pstat.close();
conn.close();
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return wowoney1;
}在页面这样写的float getcardwow=cardpay.FindWowMoney(getid); getid能得到值
但最后页面显示是0,控制台显示java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引
搞不懂了。。到底哪里错了呢?
急啊,在线等。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货