Click here to Skip to main content
15,920,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to search values on bases of multiple keyword search.I used sqldatasource and gridview control.When I'm searching value from one text bo its working properly but when I'm using two text bxes to get more expected reasult than its not working

For searching from 1 text box i'm using-
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RagistrationConnectionString %>" SelectCommand="SELECT [FirstName], [LastName], [State], [City], [SkillArea], [Skill], [WorkAuthorizationStatus], [ExpectedSalary] FROM [Resumeview] WHERE Skill Like '%' +@Skill+ '%' ">
<SelectParameters>
<asp:ControlParameter ControlID="TextBoxS" Name="Skill" PropertyName="Text" Type="String" DefaultValue="%"/>
</SelectParameters>


Which is working fine but when i'm searcching from 2 text boxes and I'm using-

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RagistrationConnectionString %>" SelectCommand="SELECT [FirstName], [LastName], [State], [City], [SkillArea], [Skill], [WorkAuthorizationStatus], [ExpectedSalary] FROM [Resumeview] WHERE Skill Like '%' +@Skill+ '%' ">
<SelectParameters>
<asp:ControlParameter ControlID="TextBoxS" Name="Skill" PropertyName="Text" Type="String" DefaultValue="%"/>
<asp:ControlParameter ControlID="TextBoxSA" Name="SkillArea" PropertyName="Text" Type="String" DefaultValue="%"/>
</SelectParameters>


its not working
Posted

1 solution

Even though you are passing value to Control parameter your Select command is same in both try to change it as

SELECT [FirstName], [LastName], [State], [City], [SkillArea], [Skill], [WorkAuthorizationStatus], [ExpectedSalary] FROM [Resumeview] WHERE Skill Like '%' +@Skill+ '%' or SkillArea Like '%' +@SkillArea+ '%'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900