locked
Table Adapter not passing null to SProc RRS feed

  • Question

  •  

    I have an SP that I call via table adapter.  If I do not pass a value in the string field ('eventRef'), the SP never gets called - it appears that the table adapter is filtering it...?  I need to be able to count records that have an 'eventRef' = to the one I pass, including null.  This works fine if I pass an 'eventRef', but never runs if that parm is empty.

     

    Here is the TA definition

     

    <asp:ObjectDataSource ConvertNullToDBNull="true" ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="ImagesByEventTableAdapters.PagedImagesByEvent" OnSelecting="ObjectDataSource1_Selecting" OnSelected="ObjectDataSource1_Selected">

    <SelectParameters>

    <asp:QueryStringParameter Name="CategoryID" QueryStringField="CategoryID" Type="Int32" DefaultValue="24"/>

    <asp:QueryStringParameter Name="EventID" QueryStringField="EventID" Type="Int32"/>

    <asp:QueryStringParameter Name="EventRef" QueryStringField="erf" Type="String"/>

    <asp:QueryStringParameter Name="PageIndex" QueryStringField="PageIndex" Type="Int32" DefaultValue="0"/>

    <asp:Parameter Name="NumRows" Type="Int32" DefaultValue="16"/>

    <asp:Parameter Name="ImageCount" Direction="Output" Type="Int32" DefaultValue="0" />

    </SelectParameters>

    </asp:ObjectDataSource>

     

     

    And the SP:

     

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    go

    ALTER PROCEDURE [dbo].[PagingGetProductsByEvent]

    @CategoryID INT,

    @EventID INT,

    @EventRef CHAR(10)=NULL,

    @PageIndex INT,

    @NumRows INT,

    @ImageCount INT OUTPUT

    AS

     

    BEGIN

    do my stuff....
    Thursday, September 27, 2007 4:04 PM