Question file upload to database

Mathh

Member
Joined
May 16, 2013
Messages
7
Programming Experience
Beginner
Hello All,

I would like to know, if there is a solution for uploading files (probably it will be PowerPoint presentation, but my employees are alloved to put into the database whatever they want - connected with the process) to Access database via VB.net Windows Form. Previously I had a database made in MS Access, so it was simple to add Attachment field to the form. Now, I would like to create a database for projects (made in ppt file) and a windows to upload the Project Files via VB.net. I have everything in my application now, but this is the last thing that I have to do, and I have no idea how to solve it.

the process is:
-Employee is filling the form with the data.
-He needs to update "Attachment" field with a presentation (ppt)
The file is saved in a table (field) tblDatabase in Access as an attachment.

I know that I have to use BLOB. I saw that for C# there are few solutions, for ASP or WebPage in .net as well, but nothing for VB.net. And I'm not interested with "image umpload".

Hopefully my problem is not that bad as I think....

Thank you in advance for your help!
 
Unfortunately, there's no easy way to work with the Attachment data type in .NET. You can use ADO.NET to retrieve attachments but even that's not as simple as other data types. I have seen some examples of using DAO to work with attachments, so that seems to be the only option for saving.

If you're prepared to forgo the Attachment data type then things become easier. The fact that you're not interested in uploading images is pretty much irrelevant. A BLOB is a BLOB. It's just binary data. You turn your file into a Byte array and then saving it and retrieving it is exactly the same regardless of the file type. You can call File.ReadAllBytes to read a file into a Byte array and File.WriteAllBytes does the opposite. Apart from that, saving and retrieving the data is the same as any other data type. You should use parameters with ADO.NET regardless but your required to when working with binary data. If you don't know how to do that then I suggest that you follow the Blog link in my signature and check out my post on Parameters In ADO.NET.
 

Latest posts

Back
Top