Binding to an MS SQL Image / VarBinary(max) column


  • I am testing Visual Studio 11, Web Development, and my initial focus is on binding controls to an MS SQL Image / VarBinary(max) column. The test is based on the controls FormView and GridView.

    After dropping a FormView on a form I start to configure the SqlDataSource. This works fine. When I test the connection the Image / VarBinary(max) column is displayed as an image. However, when I run the form the Image column is displayed as a Label / Text control, the image is not displayed. When testing a GridView control the Image / VarBinary(max) column is not displayed at all.

    I was hoping that the problem with binding to a MS SQL Image / VarBinary(max) was solved in Visual Studio 11, Web Development. Maybe this is not the case.

    The image is displayed when I test the connection, so something is apprently going on. Is there a way I can manually change the generated code for the FormView / GridView controls so that the image is displayed?. This would be great.

    Looking forward to a responce with great interest.

    Lennart Hoglund

    Lennart Hoglund

    • Moved by Mike Feng Tuesday, April 17, 2012 2:43 AM (From:.NET Platform Architecture Development Discussions)
    Thursday, April 12, 2012 9:10 AM

All replies

  • Hi Lennart,

    Welcome to the MSDN Forum.

    Please refer to forum: for more responses.

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 16, 2012 5:26 AM
  • Hi Mike,

    Thanks for your responce. I checked the forum you suggested but all "Binding to an MS SQL varbinary column" references suggested the old "plumbing work" to show a image on a web page. My assumption was that Microsoft with Visual Studio 11 had solved the problem with binding varbinary columns to a control (any control that allows binding) without the need for "plumbing work".

    Apparently there are some technical problem with a solution. Anyone knows why? I have been woking with Visual Studio from the very beginning, this is one issue that makes me a little puzzled.

    Best regards,

    Lennart Hoglund 

    Lennart Hoglund

    Monday, April 16, 2012 4:18 PM