How to set >= Condition in dropdown list using asp.net c#
Query:
if (ddlToTimeHour >= ddlFromTimeHour)
{
query = "insert into ied_fsentry(fse_Unit,fse_Line,fse_Shift,fse_Date,fsm_Id,fse_Remarks,fse_From,fse_To,fse_EntryDate) values ('" + ddlUnit.SelectedValue + "','" + ddlLine.SelectedValue + "','" + ddlShift.SelectedValue + "', '" + values[2] + "-" + values[1] + "-" + values[0] + "','" + ddlLineStoppageReason.SelectedValue + "','" + txtRemarks.SelectedItem.Text + "','" + FromtimeString.ToString() + "','" + ToTimeString.ToString() + "',now())";
Console.WriteLine("Data Succesfuuly Inserted");
}
else
{
ShowMessage("Unable to save data. Please check entry.", MessageType.Error);
}

Salman BegPosted Jun 10, 2021, 8:12 AM
If ddlToTimeHour and ddlFromTimeHour return either string then you can't apply a boolean operator to it. If your values in your dropdownlist are actually "true" and "false" Or int, then you can use it. See this link for example that how to use >=,
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/comparison-operators#greater-than-operator-