在SqlDataSource中使用LIKE語法
<asp:sqldatasource runat="server" ID="SqlDataSource1"
ConnectionString="<%$ ConnectionStrings:ftsdataConnectionString1 %>"
DeleteCommand="DELETE FROM [ExcelList] WHERE [ExcelID] = @ExcelID"
InsertCommand="INSERT INTO [ExcelList] ([Title], [ProjectID], [CreateTime]) VALUES (@Title, @ProjectID, @CreateTime)"
SelectCommand="SELECT * FROM [ExcelList] WHERE ( (@Title = '' OR ([Title] LIKE '%' + @Title + '%' OR [ProjectID] LIKE '%' + @Title + '%')) ) ORDER BY [ExcelID] DESC"
UpdateCommand="UPDATE [ExcelList] SET [Title] = @Title, [ProjectID] = @ProjectID, [CreateTime] = @CreateTime WHERE [ExcelID] = @ExcelID">
<SelectParameters>
<asp:ControlParameter ControlID="tbSearch" DefaultValue=" "
Name="Title" PropertyName="Text" Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="ExcelID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="ProjectID" Type="String" />
<asp:Parameter Name="CreateTime" Type="DateTime" />
<asp:Parameter Name="ExcelID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="ProjectID" Type="String" />
<asp:Parameter Name="CreateTime" Type="DateTime" />
</InsertParameters>
</asp:sqldatasource>