![](/img/trans.png)
[英]using selected datetime value from DropDownList and using it in an sql query condition
[英]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.