need help in function

  • Hello everyone i need ur help,i m using SQL Server 2000,here is my SP and Function,the logic of func is as i passed an image URL if this is null

    then it sets the Url of the image that was placed in my Project solution , but the problem is i want to bind this SP with the

    datagrid and whenever this URL nulls its sets the url and return the string (url) and the string is not bind with the grid

    as we always bind the columns of table in the grid, plz tell me what changes i make in my function that its works fine with my

    grid as i dont want to set the columns of my table as if its url is null i just want if null then shows the url of other image

    and displays on the grid.

    plz tell me how i do this?

    CREATE FUNCTION IfImageExists ( @imageURL varchar) 

    RETURNS varchar

    AS 

    BEGIN

     if(@imageURL=null)

     Begin

     Set @imageURL='~\Distributor\ManageListing\ItemImages\NoPreviewSmall.jpg'

     return @imageURL

      

     End

     else

     return @imageURL

    return @imageURL

    CREATE PROCEDURE GetActiveListings

    @DistributorID [int]

    AS

    SELECT    ItemID, ItemTitle, Quantity,Duration, DistributorPrice, ResellerPrice,defaultImageURL

    --dbo.IfImageExists(defaultImageURL)

    FROM         Item

    where

    istributorID=@DistributorID">DistributorID=@DistributorID and( ItemStatusID=1 or ItemStatusID=3)

    GO

    plz help me

  • CREATE FUNCTION IfImageExists ( @imageURL varchar(100))

    RETURNS varchar(100)

    AS

    BEGIN

    return isnull(@imageURL, '~\Distributor\ManageListing\ItemImages\NoPreviewSmall.jpg')

    END

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply