簡體   English   中英

如何使用 sqlDataAdapter 在 Visual Studio 中一次使用 2 個條件? 我需要從下拉列表中識別一個值並使用 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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM