Solved

Save PDF to SQL VB6

Posted on 2014-12-03
4
956 Views
Last Modified: 2015-01-02
I am working on a project and know how to save pdf to sql using c# but cannot figure it out in ADO VB6. I wan tot be able to delcare a location of the pdf and have it save that file to sql as binary.


Thanks ahead
0
Comment
Question by:desiredforsome
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Accepted Solution

by:
desiredforsome earned 0 total points
ID: 40481003
I am closing this case but would like to add my solution for anyone that is likley to find this question online.

Dim pdfpath, pdfpath1 As String
Dim sql As String

Public pdffile As ADODB.Stream
Dim database As New ADODB.Connection
Dim rs As ADODB.Recordset





Private Sub Command1_Click()
database.ConnectionString = "Provider=sqloledb; Data Source=192.168.2.121\EMMSDE;Initial Catalog=outlookreport; User Id=jsmith; Password=s5993153492;"
database.Open
sql = "SELECT * FROM PDFTABLE"
Set rs = New ADODB.Recordset

rs.Open " select * from pdftable", database, adOpenKeyset, adLockOptimistic
rs.AddNew

Set pdffile = New ADODB.Stream
pdffile.Type = adTypeBinary
pdffile.Open
pdffile.LoadFromFile "C:\test.pdf"
rs.Fields("pdf") = pdffile.Read
pdffile.Close
Set pdffile = Nothing
rs.Update
Set rs = Nothing
MsgBox "Saved"
database.Close






End Sub

Open in new window

0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 40527526
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question