Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

Inserting an OLE Object?

I need to know how to insert an OLE Object into access? But I need to know how to do it with an SQL statement so I can write it using ASP. My webpage already has the upload input field for uploading the files.
0
Ristogod
Asked:
Ristogod
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
 
  You can't do it with straight SQL.  To insert an OLE object, you need to do it via a form.

  You really don't want to do this anyway's, as Access adds its own wrapper to the object, which makes the database bloat considerably.

  Your best bet is to simply leave the object in its own file and access it as needed.

  If you really want to store it in the MDB, you can write directly to a memo field, but then you'll need to extract it to a file before you can work with it.  Without the wrapper Access won't know how to handle the field.

Jim.
0
 
Alan WarrenCommented:
Ristogod,

You wont have any control over the uploaded file untill it resides on the server.

Then to put it in a field using asp you will need to do a BinaryRead


Private mbBinaryData
Private mnTotalBytes
mnTotalBytes = Request.TotalBytes
mbBinaryData = Request.BinaryRead(mnTotalBytes)

  Set mrsApply = Server.CreateObject("ADODB.Recordset")

  With mrsApply
   .CursorLocation = adUseClient
   .CursorType = adOpenStatic
   .LockType = adLockOptimistic
  End With


  With mrsApply.Fields


   .Append "FormBinary", adLongVarBinary, 1048576, adFldMayBeNull + adFldLong
   .Fields("FormBinary").Value = mbBinaryData
  End With


hth

Regards Alan
alan@cashoz.com
0
 
RistogodAuthor Commented:
Thnx Alan

Wow? I'm just learning ASP and boy does that seem confusing. I don't think that I understand what that all means.

Another thing, how do I get the file to the server through a webpage? I want people to be able to submit papers online and have them stored in my Access DB.
0
 
Alan WarrenCommented:
Ristogod,

What stage are you up to with the upload file?
Has the user selected a file for upload?
Is the upload control within a <form> tag?
Have you posted the form to the server?

There is a bit involved with getting the upload file to the server, but once it is there the formData can be parsed and the file can be extracted from the the formBinary and reconstructed as a file.

Hang in there!
There is never any shortage of stuff to get your head around.


Good Resource:(Sample Code)
http://www.15seconds.com/issue/990723.htm
alan@cashoz.com



0
 
1WilliamCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept question, points to alanwarren
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
1William
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now