
Предположительно, машины не могут дублироваться в DataGridView< /code> но при определенных условиях это можно разрешить.
Код: Выделить всё
while (read.Read())
{
if (read["Selected_Problem"] != DBNull.Value && read["Selected_Problem"].ToString() == "#Temperature Monitoring")
{
submitToPending2();
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('This machine has been notified to Technician.')", true);
if (read.HasRows)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('This machine is currently under the status Pending or Processing. You cannot submit it again.')", true);
clearTextBox();
}
else
{
submitToPending2();
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('This machine has been notified to Technician.')", true);
//Response.Redirect("operatorView.aspx");
}
//read.Close();
//con.Close();
}
}
read.Close();
con.Close();while (read.Read())
{
if (read["Selected_Problem"] != DBNull.Value && read["Selected_Problem"].ToString() == "#Temperature Monitoring")
{
submitToPending2();
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('This machine has been notified to Technician.')", true);
if (read.HasRows)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('This machine is currently under the status Pending or Processing. You cannot submit it again.')", true);
clearTextBox();
}
else
{
submitToPending2();
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('This machine has been notified to Technician.')", true);
//Response.Redirect("operatorView.aspx");
}
//read.Close();
//con.Close();
}
}
read.Close();
con.Close();
Подробнее здесь: https://stackoverflow.com/questions/788 ... ected-cond