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
        Try
            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
        Else
            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
      
        Try
            cmd.ExecuteNonQuery()
            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
            Form1.VerilerDataSet.Resimler.Rows.Add(asdf)
            MsgBox("Data save successfully!")
        Catch ex As Exception
            '' MsgBox("error:" & ex.ToString)
        End Try
    End Sub ''tamam

Recommended Answers

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

Jump to Post

Legend:
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 > …

Jump to Post

All 5 Replies

Heeey i really need it and i dont wanna open new topic...

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 ;)

Legend:
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

Process.start(File)


Hope it can help. Good Day!


**************************************************************
iampordsartiga.
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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.