How to show a image from a Blob field in GDViewer?

Example requests & Code samples for GdPicture Toolkits.
Post Reply
bart1980
Posts: 5
Joined: Wed Nov 04, 2009 12:54 am

How to show a image from a Blob field in GDViewer?

Post by bart1980 » Wed Nov 04, 2009 1:00 am

Can somebody help me with a code that can show my images store in a Blob Field VarBinary(Max) in MS SQL 2005 database.

I use MS Virusal Studio 2008 and my program is written in VB.Net.

My dataset is DocumentView
The tablename is DocumentView
The Fieldname of my image is DocumentPicture

I Hope the hear soon.

Bart Jan

steves
Posts: 59
Joined: Fri Oct 17, 2008 4:38 pm

Re: How to show a image from a Blob field in GDViewer?

Post by steves » Wed Nov 04, 2009 4:20 pm

Hi

This is what i do with SQL 2005 but i store images in the image data type rather than varbinary(max)

Code: Select all


 Dim Bits As Byte()
 Dim Connection As New SqlConnection("data source=*servername\instance;initial catalog=*Database Name;Integrated Security=SSPI")
 Dim DataAdaptor as New SqlDataAdapter
 Dim DocumentView As New DataSet
 
 DataAdaptor.SelectCommand = New SqlCommand("select * from DocumentView where documentname = xxxxx",Connection)
 DataAdaptor.Fill(DocumentView, "DocumentView")

 Bits = CType(DocumentView.Tables(0).Rows(0).Item("DocumentPicture"), Byte())

 frmMain.Viewer.DisplayFromByteArray(bits)
 frmMain.viewer.show()

*servername\instance = the name of your SQL server and instance name i.e myserver\sql1
*Database Name = The name of your database i.e Document Database

hope this helps or gives you some clues

Cheers
steve

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests