hi
I write below code:
private void viewSMS()
{
DataTable dt = DummyDataTable();
using (SqlConnection conn = General.GetConnection())
{
using (SqlCommand cmd = General.GetCommand("ViewMalekInfo", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
SqlDataReader _dr = cmd.ExecuteReader();
if (_dr.HasRows)
{
SqlDataReader _dr1 = cmd.ExecuteReader();
while (_dr1.Read())
{
adminmobile.Text = _dr1["adminmobile"].ToString();
secmobile.Text = _dr1["secmobile"].ToString();
if (_dr1["chSarAdmin"].ToString() == "1")
{
Lbladmin.Text = _dr1["SarAdmin"].ToString();
SendSmsadmin();
}
if (_dr1["chSarmoajer"].ToString() == "1")
{
Lblmoajer.Text = _dr1["Sarmoajer"].ToString();
SendSmsMalek();
}
if (_dr1["chSarmostajer"].ToString() == "1")
{
Lblmostajer.Text = _dr1["Sarmostajer"].ToString();
SendSmsmostajer();
}
}
}
}
}
}
but below error happen:
There is already an open DataReader associated with this Command which must be closed first.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
Source Error:
Line 633: if (_dr.HasRows)
Line 634: {
Line 635: SqlDataReader _dr1 = cmd.ExecuteReader();
Line 636: while (_dr1.Read())
|
best regards
neda