وضعت الكود التالي protected void Button8_Click1(object sender, EventArgs e)
{
string SelStr = "SELECT COUNT(mobile) FROM allData";
SqlCommand cm = new SqlCommand();
SqlDataReader dr = new SqlDataReader();
SqlConnection con = new SqlConnection();
con.ConnectionString =
"server=WIDOWS7-pc;database=mydata;intgrated security= true;";
string TmpStr;
try
cm.Connection = con;
cm.CommandText = SelStr;
con.Open();
dr = cm.ExecuteReader(
CommandBehavior.SingleRow);
while (dr.Read())
TmpStr = dr.GetValue(0).ToString();
}
if ((TmpStr == string.Empty))
{
lblTotal.Text = cm.ExecuteScalar().ToString();
}
else
{
lblTotal.Text = TmpStr;
}
catch (Exception ex){
}
cm =
null;
dr.Close();
con.Close();
}
ظهرت لي رساله الخطأ التاليه: 'System.Data.SqlClient.SqlDataReader' has no constructors defined
ماالحل؟
