SQLSERVER下面请问怎么样得到count(*)的返回值
SQLSERVER下面请问怎么样得到count(*)的返回值,我这样写结果提示 System.InvalidOperationException
string selectStr = "select count(*) from Message where ReceiveUserName='"+Membership.GetUser().UserName+"' ";
SqlCommand cmd = new SqlCommand(selectStr, conn);
rdr = cmd.ExecuteReader();
int count = rdr.GetInt32(1);
希望高手能够帮我解决一下这个问题。
------解决方案--------------------rdr.read();
int count = rdr.GetInt32(1)