如何使用 sqlDataAdapter 在 Visual studio 中一次使用 2 个条件?我需要从 Dropdownlist 中识别一个值,并使用 DateTime 对其进行排序
How to use 2 conditions at a time in Visual studio using sqlDataAdapter? I need to identify a value from Dropdownlist and also sort it using DateTime
SqlDataAdapter sqlda = new SqlDataAdapter(("SELECT Master_ID,Station,Job_ID,Conveyor,Andon_PC,Cast(Start_Time as time(2) )as Start_Time,Cast(Close_Time as time(2) )as Close_Time,Duration,Loss_Type,Loss_Description,Reason,Line_Name FROM Vehicle_Andon WHERE Reason IS NULL AND (Loss_Type IS NULL OR Loss_Type !=2) AND Line_Name =" + "'" + DropDownList1.SelectedValue + "'", sqlcon) + "Cast(Date_Time as date) = " + "'" + Date1.Value + "'" + "order by Date_Time desc", sqlcon);
sqlda.Fill(dtbl);
SqlDataAdapter sqlda = new SqlDataAdapter(("SELECT Master_ID,Station,Job_ID,Conveyor,Andon_PC,Cast(Start_Time as time(2) )as Start_Time,Cast(Close_Time as time(2) )as Close_Time,Duration,Loss_Type,Loss_Description,Reason,Line_Name FROM Vehicle_Andon WHERE Reason IS NULL AND (Loss_Type IS NULL OR Loss_Type !=2) AND Line_Name =" + "'" + DropDownList1.SelectedValue + "'") + "Cast(Date_Time as date) = " + "'" + Date1.Value + "'" + "order by Date_Time desc", sqlcon);
sqlda.Fill(dtbl);
SqlDataAdapter sqlda = new SqlDataAdapter(("SELECT Master_ID,Station,Job_ID,Conveyor,Andon_PC,Cast(Start_Time as time(2) )as Start_Time,Cast(Close_Time as time(2) )as Close_Time,Duration,Loss_Type,Loss_Description,Reason,Line_Name FROM Vehicle_Andon WHERE Reason IS NULL AND (Loss_Type IS NULL OR Loss_Type !=2) AND Line_Name =" + "'" + DropDownList1.SelectedValue + "'", sqlcon) + "Cast(Date_Time as date) = " + "'" + Date1.Value + "'" + "order by Date_Time desc", sqlcon);
sqlda.Fill(dtbl);
SqlDataAdapter sqlda = new SqlDataAdapter(("SELECT Master_ID,Station,Job_ID,Conveyor,Andon_PC,Cast(Start_Time as time(2) )as Start_Time,Cast(Close_Time as time(2) )as Close_Time,Duration,Loss_Type,Loss_Description,Reason,Line_Name FROM Vehicle_Andon WHERE Reason IS NULL AND (Loss_Type IS NULL OR Loss_Type !=2) AND Line_Name =" + "'" + DropDownList1.SelectedValue + "'") + "Cast(Date_Time as date) = " + "'" + Date1.Value + "'" + "order by Date_Time desc", sqlcon);
sqlda.Fill(dtbl);