none
Convert Binary Data back into jpeg RRS feed

  • Question

  • I have an access database that has jpeg images. Currently, I have created a program that would read the database and pull out the data. But since the images have been converted into binary data, I think I need to convert the binary data back into jpeg format. 

    Can someone tell me how I can convert the binary data back into jpeg format so I can write it to a file?

    Here is my code so far:

     

    Option Explicit On
    Public Class Form1
     Private cn As ADODB.Connection
     Private rs As ADODB.Recordset
     Dim RecCount As Integer
    
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      cn = New ADODB.Connection
      cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
            "Data Source=C:\Users\Bao\Desktop\Capstone\db1.mdb"
      cn.Open()
      rs = New ADODB.Recordset
      rs.Open("Select * FROM student", cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockBatchOptimistic, 1)
      'MsgBox("Total Number of records = " & rs.RecordCount)
    
      Do While Not rs.EOF
       'MsgBox(rs.Fields("firstname").Value)
       MsgBox(rs.Fields("lastname").Value)
       rs.MoveNext()
      Loop
    
      cn.Close()
     End Sub
    End Class

    Monday, March 28, 2011 7:59 PM

Answers