Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a one search box and i want to search a value which should be either in one or both(Skill and SkillArea)rows.I'm using sqldatasource with gridview and i also tried a code as well but its not working-
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RagistrationConnectionString %>" SelectCommand="SELECT * FROM [RUPLOAD] WHERE (([Skill] LIKE '%' +@Skill+ '%') + ([SkillArea] LIKE '%' +@SkillArea+ '%'))">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Skill" PropertyName="Text" Type="String" DefaultValue="%" />
<asp:ControlParameter ControlID="TextBox1" Name="SkillArea" PropertyName="Text" Type="String" DefaultValue="%"/>
</SelectParameters>
Posted
Updated 6-Oct-15 7:13am
v2

1 solution

Try copying the code from the answer to your previous copy of this question[^] correctly.

You've replaced OR between the conditions with a +:
SQL
SELECT * FROM [RUPLOAD] WHERE (([Skill] LIKE '%' +@Skill+ '%') OR ([SkillArea] LIKE '%' +@SkillArea+ '%'))
 
Share this answer
 
Comments
[no name] 6-Oct-15 13:18pm    
You are such a genious....

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