我不能在现有数据阅读器中打开新的数据阅读器吗?请帮助我。我是 C# 新手
string statement11 = "SELECT Planning FROM allow where NPLID=(SELECT MAX(NPLID) FROM allow)";
SqlCommand myCommand11 = new SqlCommand(statement11, con1);
SqlDataReader plan2 = myCommand11.ExecuteReader();
while(plan2.Read())
if (!plan2.IsDBNull(0) && "ok" == plan2.GetString(0))
{
string statement99 = "SELECT Dropplan FROM NPLQAnew where NPLID=(SELECT MAX(NPLID) FROM allow)";
SqlDataReader myReader1 = null;
SqlCommand myCommand114 = new SqlCommand(statement99, con1);
SqlDataReader plandrop = myCommand114.ExecuteReader();
while (plandrop.Read())
if (plandrop.IsDBNull(0) && plandrop.GetString(0) == "Red")
{
Lblplan1.BackColor = System.Drawing.Color.Red;
}
else if (plandrop.IsDBNull(0) && "amber" == plandrop.GetString(0))
{
Lblplan1.BackColor = System.Drawing.Color.Orange;
}
else if (plandrop.IsDBNull(0) && "Green" == plandrop.GetString(0))
{
Lblplan1.BackColor = System.Drawing.Color.Green;
}
plandrop.Close();
this.Lblplan1.Visible = true;
}
plan2.Close();