Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Save PDF to SQL VB6

Posted on 2014-12-03
4
Medium Priority
?
1,050 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 49

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

719 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