p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   .NET 4.5.1 and Visual Studio 2013 General Discussions (http://p2p.wrox.com/forumdisplay.php?f=759)
-   -   Binding A SQL Image Field To A Picture Box (http://p2p.wrox.com/showthread.php?t=98997)

testsubject May 27th, 2016 05:39 PM

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

All times are GMT -4. The time now is 07:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.