i have a table and oleobj column in this table. i save some files to oleobj. and i need to open them how i can do that.

for example i save ppt in oleobj and ineed to open this powerpoint file how can i do ..

2nd question.
can i use some files on filesteam or memorystream or something like this?
here are my saving codes

OpenFileDialog1.Title = "Get Image"
        With OpenFileDialog1
            .Filter = "All Files|*.*|"
            .FilterIndex = 1
        End With
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            Dim bytes() As Byte
            bytes = My.Computer.FileSystem.ReadAllBytes(OpenFileDialog1.FileName)
        End If
        savefile(OpenFileDialog1.FileName, RTBResim.Text, TSTBindex.Text)

 Public Sub savefile(ByVal filepath As String, ByVal açıklama As String, ByVal kişiindex As Integer) ''tamam

        Dim bytes() As Byte
            bytes = System.IO.File.ReadAllBytes(filepath)
        Catch : MsgBox("Bu dosya bulunamadı veya yok")
        End Try

        Dim sindex As Integer '' its not important
        If KayıtStringFile = "&" Then
            sindex = Form1.VerilerDataSet.Resimler.Rows.Count
            sindex = kayıtidbulma(KayıtStringFotoğraf, KayıtStringFotoğraf)
        End If        

        Dim cmd As New OleDb.OleDbCommand("insert into Resimler (Fileindex,File,Fileinfo) values (" & sindex & ",@File," & açıklama & ")", Form1.cnnctn)
        cmd.Parameters.Add("@File", OleDb.OleDbType.Binary, bytes.Length).Value = bytes
            resimindexekle(sindex, kişiindex)' its not important
            Dim asdf As DataRow = Form1.VerilerDataSet.Resimler.Rows(0)
            asdf(0) = sindex : asdf(1) = bytes : asdf(2) = açıklama
            MsgBox("Data save successfully!")
        Catch ex As Exception
            '' MsgBox("error:" & ex.ToString)
        End Try
    End Sub ''tamam

Edited by Oneryavuz: n/a

5 Years
Discussion Span
Last Post by Oneryavuz

Are you just trying to open the saved file or are you trying to open it and be able to edit the file?


i m need to open it and be able to edit but if i can open :D ill solve editing so i just need open ;)


pptfile= column of your file in db
Table = your db table

cmd = New OleDbCommand("SELECT pptfile FROM Table WHERE index=0", con)
adap = New OleDbDataAdapter(cmd)
Dim ds As New DataSet()
dtradap.Fill(ds, "Table")
Dim counter As Integer = ds.Tables("Table").Rows.Count
Dim file as String = Nothing
If counter > 0 Then
Dim bytBLOBData() As Byte = _
ds.Tables("Table").Rows(counter - 1)("pptfile")
Dim stmBLOBData As New MemoryStream(bytBLOBData)
File = stmBLOBData
End If

'To run the ppt file


Hope it can help. Good Day!

its really hard to find the right answer if you don't know the right question.


wow u r awsome ill try :) yea its hard but i got the point how can i do this. thx a lot :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.