select count(*) as co from Score
麻烦你们了,帮小弟解释一下上面这句的意思,我要用DataList分页
还有这句:
if(dr.Read())
{
intCount = Int32.Parse(dr["co"].ToString());
}
else
{
intCount = 0;
}
谢谢了
麻烦你们了,帮小弟解释一下上面这句的意思,我要用DataList分页
还有这句:
if(dr.Read())
{
intCount = Int32.Parse(dr["co"].ToString());
}
else
{
intCount = 0;
}
谢谢了
====
很简单的啊.得到score这个表中的总行数.放到列名为co的列下
{
intCount = Int32.Parse(dr["co"].ToString());
}
else
{
intCount = 0;
} dr是一个datareader,如果dr中有值将上面得到的总行数的值赋给intCount,如果没有将intCount归0.
{
//把读出的内容转化为整数,存到intcount中
intCount = Int32.Parse(dr["co"].ToString());
}
else
{
//读取不成功,设0值
intCount = 0;
}
1为bhwhy(苏秦) 所说;Parse(dr["co"].ToString())
得到查询结果,为string类型;
Int32.Parse(dr["co"].ToString())把string转换成int类型
intCount = Int32.Parse(dr["co"].ToString());
赋值给intCount