Reputation: 1
([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="String" />
<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>
Upvotes: 0
Views: 745
Reputation: 12003
Try this:
Card_no like '%{0}%'
Or if you must use named parameters:
Card_no like '%'+@search +'%'
Upvotes: 1