I got "Invalid attempt to call Read when reader is closed" error. How i resolve it ?
string fetch_isbn = "Select rc.cartdetail_isbn,rc.cartdetail_qty,sb.quantity as old_qty From rt_cartdetail as rc join sell_book as sb on sb.product_id = rc.cartdetail_isbn where rc.cartdetail_cartid='" + Session["cart_pid"] + "'";SqlCommand objcmd_ISBN = new SqlCommand(fetch_isbn, objconn);objconn.Open();{SqlDataReader reader_isbn = (SqlDataReader)objcmd_ISBN.ExecuteReader();if (reader_isbn != null && reader_isbn.HasRows){while (reader_isbn.Read()){string isbn = reader_isbn["cartdetail_isbn"].ToString();int qty = Convert.ToInt32(reader_isbn["cartdetail_qty"]);int old_qty = Convert.ToInt32(reader_isbn["old_qty"]);int new_qty = 0;new_qty = old_qty - qty;reader_isbn.NextResult();// objconn.Close();string update_sellqty = "Update sell_book set quantity = '" + new_qty + "' where product_id='" + isbn + "'";SqlCommand objcmd_update_sellqty = new SqlCommand(update_sellqty, objconn);//objconn.Open();objcmd_update_sellqty.ExecuteNonQuery();// objconn.Close();}}}