Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save a PDF File from ACCESS to SQL server?

Status
Not open for further replies.

jmasm

Programmer
Sep 1, 2010
22
PT
I’m trying to save a PDF File from ACCESS2010 to SQLserver2008.
I'm using the following code:
'using the Microsoft activeX Data Object 2.7
Set rs = New ADODB.Recordset
strSQL = "SELECT doc FROM ArquivoPDM"
rs.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.LoadFromFile "C:\Desktop\PDM_Arquivos\doc.pdf"
rs.AddNew
rs.Fields("doc").Value = mstream.Read
rs.Update
rs.Close
mstream.Close
Set rs = Nothing

When I use the code the following error appears:

The data provider or other service returned a status E_Fail

Some type of help would be great.
Thanks’ to anyone who try helping.

rs.Update
rs.Close
mstream.Close
Set rs = Nothing

When I use the code the following error appears:

The data provider or other service returned a status E_Fail

Some type of help would be great.
Thank's to any one who try helping.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top