I am going to try to explain this the best I can
I didn't develop the original version of this, or the part that rights it to the database.
in our company, there is a program that takes PDF files and stores them in our mysql database as blobs. The blobs are attached to inventory items by the inventory items ID. they are basically certificates. That is basically all I know about it.
however, I was asked to show the PDF files for certain associates that may want to view them. ie, if a sales person looks up item 1234 and there is a stored PDF certificate for the item, be able to access the pdf and show it to the employee if they want to see it.
The code that I found that was previously wrote to view the PDFs takes the blog, create the file in the app.path directory, and then uses shell to launch it like a normal PDF.
I don't have a problem using the adobe pdf reader to launch the file, but is there a more efficient way other than creating the file on any machine in our company where someone wants to view the PDF ?
hopefully that is clear, here is the code that reads the blob currently:
Dim adoconnect As New ADODB.Connection
Dim adors As New ADODB.Recordset
Dim found As Boolean
adoconnect.Open "DSN=" & clssystem.DSN, clssystem.System_User, clssystem.System_Password
found = False
adors.Open "Select * from inventory_certs where stock_number = '" & Me.Stock_Number & "' ", adoconnect
If adors.EOF = False Then
LoadImage adors, adors.Fields("file_name")
found = True
End If
adors.Close
Set adors = Nothing
Set adoconnect = Nothing
Private Function LoadImage(ByRef rs As ADODB.Recordset, FileName As String) As Boolean
Dim st As New ADODB.Stream
Dim strTemp As String
strTemp = App.Path & "\"
st.Type = adTypeBinary
strTemp = strTemp & FileName
st.Open
st.Write rs.Fields("data").Value
st.SaveToFile strTemp, adSaveCreateOverWrite
'Shell "open " & strTemp
Shell "Cmd /c """ & strTemp & """", vbHide
'Kill (strTemp)
st.Close
Set st = Nothing
End Function
* note, this code is in VB6 I haven't upgraded it to .NET yet because I don't want to upgrade a code that I don't like.
Thanks.