I use two reader rdr1,rdr2
after usage of first reader i close that by rdr1.close();
then I used second reader but i found run time error which is illustrate below
There is already an open DataReader associated with this Command which must be closed first.
SqlDataReader rdr1 = ck1.ExecuteReader();
while (rdr1.Read())
{
if (rdr1.HasRows)
{
if (rdr1["Pno"].ToString() == pmemno.Text)
{
q1 = "delete from Principal where PID = '" + @pmemno.Text.ToString() + "'";
SqlCommand c1 = new SqlCommand(q1, cn);
c1.ExecuteNonQuery();
}
else { }
}
}
rdr1.Close();
rdr1.Dispose();
SqlDataReader rdr2 = ck2.ExecuteReader();
while (rdr2.Read())
{
if (rdr2.HasRows)
{
if (rdr2["Addno"].ToString() == v2.ToString())
{
q2 = "delete from Address where Addno = '" + v2 + "'" + " and street = '" + paddr.Text.ToString() + "'";
SqlCommand c2 = new SqlCommand(q2, cn);
c2.ExecuteNonQuery();
}
else { }
}
Please help me...