我把Oracle查询结果赋值给Int型变量,但是编译时,却无法识别,这时为何? 在线等急
程序代码如下: int thjx;
int mesjx;
int netjx;
String shoppingjxSql="select * from tb_shopping_score where phonenum='"+mobile_customer_phonenum+"'";
rs = dbconn.executeQuery(shoppingjxSql);
while(rs.next())
{
thjx=Integer.parseInt(rs.getString("th_score"));//获得剩余通话积分
mesjx=Integer.parseInt(rs.getString("mes_score"));//获得剩余短信积分
netjx=Integer.parseInt(rs.getString("net_score"));//获得剩余梦网积分
}
<td width="60" >
<%=thjx%>
</td>
<td width="60"><%=mesjx %>
</td>
<td width="60"><%=netjx %>
</td>
这里面thjx,mesjx,netjx三变量都未被识别,何解?
程序代码如下: int thjx;
int mesjx;
int netjx;
String shoppingjxSql="select * from tb_shopping_score where phonenum='"+mobile_customer_phonenum+"'";
rs = dbconn.executeQuery(shoppingjxSql);
while(rs.next())
{
thjx=Integer.parseInt(rs.getString("th_score"));//获得剩余通话积分
mesjx=Integer.parseInt(rs.getString("mes_score"));//获得剩余短信积分
netjx=Integer.parseInt(rs.getString("net_score"));//获得剩余梦网积分
}
<td width="60" >
<%=thjx%>
</td>
<td width="60"><%=mesjx %>
</td>
<td width="60"><%=netjx %>
</td>
这里面thjx,mesjx,netjx三变量都未被识别,何解?
int mesjx;
int netjx;
加public属性
rs.getInt("th_score")可以直接用;
我自己写的一个简单的select操作你可以看看:
http://blog.oracle.com.cn/index.php/76292/viewspace-30567.html