IndexOutOfRangeException的问题
SqlConnection RegCon = new SqlConnection(ConfigurationManager.AppSettings["SQLConn"]);RegCon.Open();
SqlCommand checkname = new SqlCommand("select count (*) from UserInfo where Name='" + this.LoginIDEnter.Text + "' and PW='" + this.LoginPWEnter.Text + "'",RegCon);
SqlDataReader checkid = checkname.ExecuteReader();
if (checkid.Read())
{
userid = checkid["Name"].ToString();
}
在userid = checkid["Name"].ToString()这里报错,请问是错在哪里?谢谢。