请问如何读取数据?(c#)

来源:百度知道 编辑:UC知道 时间:2024/05/22 20:56:36
select count(*) from content

查询分析器中显示的是111条,

我如何用datareader读取这个数据?

给我加分吧 港告诉你了
string commandText="select count(*) from content ";

SqlCommand cm=new SqlCommond(commandText,con);
SqlDataReader dr=cm.ExcuteReader();
int Count;
while(dr.Read())
{
count=Convert.ToInt16(dr[0]);
}