Как запретить тому, чтобы на одной и той же машине было две строки данных, но для выбранного условия это будет разрешено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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

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