2014-01-15 13 views
2
<asp:TextBox ID="date_tb" runat="server" TextMode="Date"></asp:TextBox> 

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>" SelectCommand="SELECT * FROM [table_1] WHERE [type]='AAA'" FilterExpression="[ScheduledDateTime] = #{0}#"> 

<asp:ControlParameter Name="ScheduledDateTime" ControlID="date_tb" PropertyName="Text" type="DateTime"/> 

열은 datetime입니다.필터 날짜와 날짜를 비교하십시오.

date_tb 텍스트 상자에만 날짜가 있습니다.

두 개를 어떻게 비교합니까?

CAST()는 SQL Server의 FilterExpression

CONVERT()에서 작동하지 않습니다 FilterExpressionCONVERT() 다른하시기 바랍니다.

FilterExpression="[ScheduledDateTime] <= #{0}# AND [ScheduledDateTime] >= #{0}#""을 사용해 보았지만 아무런 결과도 반환하지 않았습니다.

답변

0

결과는 날짜

을에 있기 때문에 시간 부분의 반환되지 않습니다 FilterExpression="[ScheduledDateTime] <= #{0}# AND [ScheduledDateTime] >= #{0}+1#"" 시도하십시오
관련 문제