Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Error: sql_variant is incompatible with image

    Hi,

    I have form that contains data from a table including a hyperlink to a photo that uses the imagecontrol. When I go to edit the table via the form I get this error:

    sql_variant is incompatible with image

    And, when I go to delete a row nothing happens. I'm not sure what is wrong. The source code is as follows:

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"

    SelectCommand="SELECT * FROM [tblPhotoOrders] ORDER BY [PhotoNumber]" DeleteCommand="DELETE FROM [tblPhotoOrders] WHERE [PhotoId] = @PhotoId" InsertCommand="INSERT INTO [tblPhotoOrders] ([PhotoId], [EmailAddress], [PhotoNumber], [TimeStamp], [4x6], [5x7], [8x10], [Custom], [Image], [WeddingName], [ImageUrl]) VALUES (@PhotoId, @EmailAddress, @PhotoNumber, @TimeStamp, @column1, @column2, @column3, @Custom, @Image, @WeddingName, @ImageUrl)" UpdateCommand="UPDATE [tblPhotoOrders] SET [EmailAddress] = @EmailAddress, [PhotoNumber] = @PhotoNumber, [TimeStamp] = @TimeStamp, [4x6] = @column1, [5x7] = @column2, [8x10] = @column3, [Custom] = @Custom, [Image] = @Image, [WeddingName] = @WeddingName, [ImageUrl] = @ImageUrl WHERE [PhotoId] = @PhotoId">

    <DeleteParameters>

    <asp:Parameter Name="PhotoId" Type="Object" />

    </DeleteParameters>

    <UpdateParameters>

    <asp:Parameter Name="EmailAddress" Type="String" />

    <asp:Parameter Name="PhotoNumber" Type="Byte" />

    <asp:Parameter Name="TimeStamp" Type="DateTime" />

    <asp:Parameter Name="column1" Type="Byte" />

    <asp:Parameter Name="column2" Type="Byte" />

    <asp:Parameter Name="column3" Type="Byte" />

    <asp:Parameter Name="Custom" Type="String" />

    <asp:Parameter Name="Image" Type="Object" />

    <asp:Parameter Name="WeddingName" Type="String" />

    <asp:Parameter Name="ImageUrl" Type="String" />

    <asp:Parameter Name="PhotoId" Type="Object" />

    </UpdateParameters>

    <InsertParameters>

    <asp:Parameter Name="PhotoId" Type="Object" />

    <asp:Parameter Name="EmailAddress" Type="String" />

    <asp:Parameter Name="PhotoNumber" Type="Byte" />

    <asp:Parameter Name="TimeStamp" Type="DateTime" />

    <asp:Parameter Name="column1" Type="Byte" />

    <asp:Parameter Name="column2" Type="Byte" />

    <asp:Parameter Name="column3" Type="Byte" />

    <asp:Parameter Name="Custom" Type="String" />

    <asp:Parameter Name="Image" Type="Object" />

    <asp:Parameter Name="WeddingName" Type="String" />

    <asp:Parameter Name="ImageUrl" Type="String" />

    </InsertParameters>

    </asp:SqlDataSource>



    Thanks!

    Leesha

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error: sql_variant is incompatible with image

    Leesha

    I am having a guess here but I have a feeling you will have to set the inage as Long Binary data type
    Jerry

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error: sql_variant is incompatible with image

    Oh! You beat me back to the lounge! I just came back to post that I actually figured this one out on my own. I had been at it all night and early this am when I finally decided to post it to the lounge and admit defeat. Anyway, while waiting to hear back, I went back to the only post I could find with a similar issue and it had to do with upload of image files, which was something I wasn't doing so I kept blowing it off. Well, as I read the responses, I found something about image data types causing problems on upload and they had to be labeled as nvarchar. I still didn't think it pertained to me as I'm using a hyperlink vs an image data type. I went back the table to go through each column and sure enough there was the original image column with a data type of image that I had never taken out. I deleted it, udated all my stuff and low and behold it worked! No more errors!

    I'm tickled! Of course I've got a long way to go in learning this stuf but I'm starting to "get it". At least I don't feel as if there is a big black void in my head anymore. I have to say that I do absolutely love asp.net 2.0 and the visual web developer as the interface is so similar to the thought process behind working with Access so I don't feel like I'm totally on foreign territory!!

    Thanks,
    Leesha

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error: sql_variant is incompatible with image

    <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35> <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35> <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35>
    Jerry

  5. #5
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error: sql_variant is incompatible with image

    LOL! That is exactly what I've looked like all morning at my house. I think this is the first time I've ever posted back to the lounge with an answer!
    Snoopy Dance of Joy!
    Leesha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •