Question : Select parameters ASP.NET

Hello folks,

I have a question, I am tryng to find a record by its name or last name,, I am using an Access Data Source and the following parameters , but the code is not working as I expect,,, If I use only the Name and a control parameter it does work, bu I need both .... how would I go about this? Thanks

Please see the query I am using
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
<asp:AccessDataSource ID="AccessDataSource2" runat="server" 
        DataFile="~/App_Data/Providers.accdb" 
        SelectCommand="SELECT [First_Name],[Last_Name],[Prof_Designation], [Specialty], [Specialty2],[Address], [Address2], [City], [State], [Zip], [Phone], [Fax], [lat], [lng] FROM [tbl_Providers] WHERE  
        (@First_Name IS NULL OR First_Name LIKE '%' +  @First_Name + '%') AND
        (@Last_Name IS NULL OR Last_Name LIKE '%' +  @Last_Name + '%') AND
        (@Specialty IS NULL OR Specialty LIKE '%' + @Specialty + '%') AND  
        (@Zip IS NULL OR Zip LIKE '%' + @Zip + '%')"
         CancelSelectOnNullParameter="False">
        <SelectParameters>

        <asp:ControlParameter ControlID="providerTextBox" Name="First_Name"  PropertyName ="Text" Type="String"  ConvertEmptyStringToNull ="true" />
        <asp:ControlParameter ControlID="providerTextBox" Name="Last_Name"  PropertyName ="Text" Type="String"  ConvertEmptyStringToNull ="true" />
        <asp:ControlParameter ControlID="specialityDropDown" Name="Specialty" PropertyName ="SelectedValue" Type="String" ConvertEmptyStringToNull ="true" />
        <asp:ControlParameter ControlID="txtZipCode" Name="Zip" PropertyName ="Text" Type="String" ConvertEmptyStringToNull ="true"  />

        
     </SelectParameters>

Answer : Select parameters ASP.NET

then you probably want to use OR instead of AND.
Random Solutions  
 
programming4us programming4us