Storing Image in the database Column

  • i want to store the mage into my database column from the variable

    not by using parameter.

    This is working

    update Tour Set TourImage=@TourImage where TourId=" & nTouriD.

    but i want to fire the query like this

    update Tour Set TourImage=" & TourImage & " where TourId=" & nTouriD.

    or

    update Tour Set TourImage='" & TourImage & "' where TourId=" & nTouriD.

    if we write query like this it is giving error "Cannot Convert the 1-Dimention array to String variable"

    please tell me how to write the query.

  • Are you using VB.net? The Image datatype requires specialized handling, especially from client code. I think that you would be better to use Varbinary(MAX), passed through a parametized query of else a stored procedure and then converted to an image in the UPDATE command.

    If you do not want to do that, then I would try using the code you had before, but with a Varbinary(MAX) and again convert to Image from there.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Hi

    Don't try to concatenate a complete UPDATE statement with all values. Use the SqlParameter objects instead.

    Greets

    Flo

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

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