hitcounter_SQL="select sum(hitcounter) as hitsum from news where newscourse="+cid;
rshitsum=DBconn2.executeQuery(hitcounter_SQL);
if(rshitsum.next())
{
sumhitcounter=rshitsum.getString("hitsum");
}hitcounter列非空,默认是0可是我这么取出和值,输出为null是不是写法的问题,谢谢
rshitsum=DBconn2.executeQuery(hitcounter_SQL);
if(rshitsum.next())
{
sumhitcounter=rshitsum.getString("hitsum");
}hitcounter列非空,默认是0可是我这么取出和值,输出为null是不是写法的问题,谢谢
如果不是的话把select 语句的条件加个''
这句话有问题
hitcounter_SQL= "select sum(hitcounter) as hitsum from news where newscourse= ‘”+cid+“’";
水平有限只发现这里有问题
肯定是语句有问题
看看cid这个是什么类型的
要是varchar要加''的
你这个hitsum只是一个别名撒!
你直接用sumhitcounter=rshitsum.getString(1);试试看!