+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Save image with procedure.

Save image with procedure.

2 posts, 0 answered
  1. Gadonski
    Gadonski avatar
    3 posts
    Registered:
    29 Jul 2010
    23 Sep 2010
    Link to this post
    I am using Telerik's ORM...

    This stored procedure does not save the data, it seems to be a problem with the VARBINARY. I am passing a byte[] to it, but then it doesn't work. If I send this parameter as NULL it works.

    "QP_AddCommunity ?, ?, ?, ?, ?, ?", "VARCHAR Name, VARCHAR Description, VARBINARY Picture, INTEGER Owner, INTEGER Venue, INTEGER ID"


    Here is my procedure, which works just fine executing directly on SQLServer.
    USE [redimob]
    GO

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[QP_AddCommunity]
        @Name VARCHAR(120),
        @Description VARCHAR(MAX),
        @Picture VARBINARY(MAX),
        @Owner INTEGER,
        @Venue INTEGER,
        @ID INTEGER
         
    AS
    BEGIN
        SET NOCOUNT ON;
     
        IF(SELECT COUNT(*) FROM QT_Community WHERE ID = @ID) = 0
            INSERT INTO QT_Community(Name, [Description], Picture, [Owner], Venue) VALUES(@Name, @Description, @Picture, @Owner, @Venue);
             
        ELSE
            UPDATE QT_Community SET Name = @Name, [Description] = @Description, Picture = @Picture, [Owner] = @Owner, Venue = @Venue WHERE ID = @ID;
             
        SELECT * FROM QT_Community WHERE ID = @@IDENTITY;
             
         
    END

    What am I doing wrong? Isn't VARBINARY a byte[] ?
  2. Ady
    Ady avatar
    1 posts
    Registered:
    11 Oct 2016
    29 Sep 2010
    Link to this post
    Hello André,

     There is a bug when dealing with VARBINARY parameters and stored procedures. This has been fixed now and the fix would be available in the next build that we will soon release.

    Sorry for the inconvenience caused.

    All the best,
    Ady
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered