大攻防怎么看多少贡献:asp.net中数据库统计数字的应用

来源:百度文库 编辑:中科新闻网 时间:2024/05/03 01:49:14
string sqlstr="select count(*) from table;"
conn = new OleDbConnection();
conn.ConnectionString = "连接配置";
conn.Open();
cmd = new OleDbCommand(sqlstr, conn);
odr = cmd.ExecuteReader();
odr.Read();
int i;
i=odr.什么属性或方法或如何强制转换把统计的记录数字赋值给i?

试试:
i=0;
while (odr.Read())
{
i++;
}