How to retrieve a bitmap-image from a SQL Server image field using ADO 
Author Message
 How to retrieve a bitmap-image from a SQL Server image field using ADO

I have a bitmap-image stored in an 'image'-type field in a SQL Server
7.0 table. I use this code to retrieve it:

     Dim Cn As ADODB.Connection
     Dim Rs As ADODB.Recordset
     Dim vImage As Variant
     Const ChunckSize = 100

     Set Cn = CreateObject ("ADODB.Connection")
     Set Rs= CreateObject("ADODB.Recordset")

     With Cn
       (...)
       .Execute
     End With

     Rs.Open "SELECT ImageField FROM Table (...)", Cn, (...)
     (...)
     While len(vImage) < len(Rs.Field("ImageField").Value)
       vImage = vImage & Rs.Fields("ImageField").AppendChunck
     (ChunckSize)
       (...)
     Wend

     Picture1.Picture = vImage
     (...)

Now Picture1 is a Picture-control and Picture1.Picture expects an object
type. 'vImage' is a variant. This gives a type mismach error.
How can I load the retrieved image (data-type) and put it in the
Picture-control?



Thu, 20 Feb 2003 20:59:13 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Assigning a picture to an Image field in SQL server, using ADO

2. Assigning a picture to an Image field in SQL server, using ADO

3. Retrieving an Image from SQL Server Image column (binary)

4. Save image in Sql Server and retrieve image from sqlserver to vb

5. Binding an Image control to an Image field in SQL Server

6. Binding an Image control to an Image field in SQL Server

7. Retrieve Bitmap of preview image - Summary Info - Save Preview Image

8. Store and retrieve image on SQL server 7.0 using VB 6.0

9. SQL Server - Image Field - ADO.net with XML

10. How to store images using ADO in SQL Server 2000

11. how to upload image to sql server by using ADO

12. Saving images in a SQL Server DB using ADO

 

 
Powered by phpBB® Forum Software