Как запретить тому, чтобы на одной и той же машине было две строки данных, но для выбранного условия это будет разрешеноC#

Место общения программистов C#
Anonymous
Как запретить тому, чтобы на одной и той же машине было две строки данных, но для выбранного условия это будет разрешено

Сообщение Anonymous »


Изображение

Предположительно, машины не могут дублироваться в 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

Вернуться в «C#»