- How to change to use like instead of = ?
([Card_no] = @Search)
Moreover, if i want to show all in default, this method force to user to type something first. How to show all in default when using control parameter?
SelectCommand="SELECT [Serial_no], [Transaction_Date], [Card_no], [Company],[IsCredit], [Fee] FROM [CarPark] WHERE ([Card_no] = @Search) or ([Company] = @Search)" UpdateCommand="UPDATE [CarPark] SET Card_no=@Card_no, Company=@Company, IsCredit=@IsCredit, Fee=@Fee WHERE Serial_no=@Serial_no"> <UpdateParameters> <asp:Parameter Name="Card_no" Type="Str开发者_如何转开发ing" /> <asp:Parameter Name="Company" Type="String" /> <asp:Parameter Name="IsCredit" Type="Boolean" /> <asp:Parameter Name="Fee" Type="Double" /> </UpdateParameters> <SelectParameters> <asp:ControlParameter ControlID="Search_TextBox" DefaultValue="" Name="Search" PropertyName="Text" Type="String" /> </SelectParameters>
Try this:
Card_no like '%{0}%'
Or if you must use named parameters:
Card_no like '%'+@search +'%'
精彩评论