2016-10-08 3 views
0
<asp:TextBox ID="TextBox1" runat="server" style="text-align: center; margin-left: 15px; margin-top: 16px" OnTextChanged="TextBox1_TextChanged"></asp:TextBox> 

<asp:Button ID="Button1" runat="server" Text="Search" Width="73px" Height="26px" OnClick="Button1_Click" /> 

<asp:GridView ID="GridView2" runat="server" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="GridView2_SelectedIndexChanged" Width="1322px" OnRowCommand="GridView2_RowCommand" Height="330px" style="text-align: center"> 

<asp:BoundField DataField="person_num" HeaderText="person_num" SortExpression="person_num"/
    <asp:BoundField DataField="creation_date" HeaderText="creation_date" SortExpression=creationn_date" /> 

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:bConnectionString %>" SelectCommand="SELECT dbo.UtcToLocal(creation_date), [action_id], [terminal_name], [ [person_num] FROM [TEST] WHERE ([person_num] LIKE '%' + @person_num + '%') or ([creation_date] LIKE '%' + @creation_date + '%') ;" OnSelected="SqlDataSource1_Selected"> 
    <SelectParameters> 
<asp:ControlParameter ControlID="TextBox1" Name="person_num" PropertyName="Text" Type="String" /> 
<asp:ControlParameter ControlID="TextBox1" Name="creation_date" PropertyName="Text" Type="String" /> 

</SelectParameters> 
      </asp:SqlDataSource> 

私はの代わりにdateでデータをフィルタリングしたいと思います。ASP.NET Gridview日付フィルタ

+0

使用して日付部分を比較するために、次のSQLを使用して、BETWEEN以上レスの日付を比較するための記号より。 –

答えて

0

のみ提供日付

(CONVERT(VARCHAR(10), [creation_date] , 110)) >= @creation_date and CONVERT(VARCHAR(10), [creation_date] , 110)) <= @creation_date) 
関連する問題