Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ATECH1\Documents\pdf.accdb") Dim DestFilePath As String = "C:\Documents\pdf.accdb " Dim RetVal As Long Dim FieldLen As String con.Open() Dim cmd As New OleDbCommand("select filename from files where filename= '" & TextBox1.Text & "' ", con) ' With cmd.Parameters '.AddWithValue("@filename", TextBox1.Text) Try Dim AccessDataReader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection) AccessDataReader.Read() FieldLen = AccessDataReader.Item("filename").ToString Dim BlobByteArray(FieldLen - 0) As Byte Dim startIndex As Integer = 0 RetVal = AccessDataReader.GetBytes(0, startIndex, BlobByteArray, 0, BlobByteArray.Length) Dim FileStreamObject As New System.IO.FileStream(DestFilePath, IO.FileMode.Open, IO.FileAccess.Write) FileStreamObject.Write(BlobByteArray, 0, BlobByteArray.Length) FileStreamObject.Close() AccessDataReader.Close() con.Close() Catch ex As Exception MsgBox(ex.ToString) End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)