Wrox Programmer Forums
.NET 4.5.1 and Visual Studio 2013 General Discussions For discussing anything about .NET 4.5.1, WPF, WCF, the rest of the .NET 4.5.1 Framework, and Visual Studio 2013 that isn't about a specific Wrox book. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET 4.5.1 and Visual Studio 2013 General Discussions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 27th, 2016, 05:39 PM
Authorized User
Join Date: Dec 2005
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Binding A SQL Image Field To A Picture Box

I hope you can help me as I have been searching Google all over to try and get some definitive answers.

I'm using Visual Studio Enterprise 2015, Visual Basic, Windows Forms Applications.

This is what I have so far:

        Dim dsPODs As DataSet
        Dim daTransport As SqlDataAdapter
        Dim conTransport As New SqlConnection("...")

        Dim PITSGetPODDetail As New SqlCommand()
        PITSGetPODDetail.Connection = conTransport
        PITSGetPODDetail.CommandText = "ssp_PITSGetPODDetail"
        PITSGetPODDetail.CommandType = CommandType.StoredProcedure
        PITSGetPODDetail.Parameters.AddWithValue("@JobNumber", Int16.Parse(JobNumber))

        dsPODs = New DataSet()

        daTransport = New SqlDataAdapter(PITSGetPODDetail)
        daTransport.Fill(dsPODs, "PODDetail")

        Dim bytBLOBData() As Byte = dsPODs.Tables(0).Rows(0)("ImageData")
        Dim stmBLOBData As New MemoryStream(bytBLOBData)
        picPODViewer.Image = Image.FromStream(stmBLOBData)
        daTransport = Nothing
        dsPODs = Nothing
The ssp_PITSGetPODDetail stored procedure simply returns any images which matches the Job Number passed to it. The field which is returned is a SQL Image field.

So, the above works to a fashion but needs further work which I am unable to fathom out.

What I would like to happen is a dataset is populated with a number of "images" and then use the Binding Navigator to move the Picture Box through the dataset.

Any help would be greatly appreciated.

Thank you

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to display a Large Image in relatively small picture box RK .NET Framework 1.x 0 January 14th, 2009 06:49 AM
Picture Box proportional to original image. watashi C# 1 April 17th, 2008 02:30 AM
Picture box container controls save to image mujeeb General .NET 0 May 20th, 2006 03:46 AM
How to binding picture file in database ? mojo VB.NET 1 September 7th, 2005 06:49 PM
retriving picture from database(sql) to <asp:image aspnet79434319 Classic ASP Basics 0 June 21st, 2005 01:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.