Open a File that is stored in DB - Using Windows Form

Hello

I have a DB that has a table called [MyTable], This [MyTable] has two columns:

1. [ID] of type int
2. [Data] of type varbinary(max)

I use this table to upload and store files to it using a Windows Form

Now, in that same Windows Form I have a button, and upon clicking on this button, I want to open the file stored - in binary format - from that [Data] column of that [MyTable]

How do I do that? Once again, I'm using Windows Form
Hussein ZahranAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
which mechanism are you using to save it? It should be relatively similar to restore it.
Hussein ZahranAuthor Commented:
I upload my files from an SQL Statement directly, read my other post that tells you how I od the upload:

http://www.experts-exchange.com/questions/28762899/Issue-with-using-a-SELECT-statement-with-OPENROWSET-function.html

However; I just found the solution now:

1. I get the varbinary column contents into a dataset table

2. store that table binarycolumn into an array of bytes

3. I use System.IO.File.WriteAllBytes method to store those bytes as a file in a temp folder locally

4. I use Process.Start method to open the file from that local path that I already stored the file in from step (3) above


So, the issue has been resolved.

Thank you for trying to help out though

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hussein ZahranAuthor Commented:
After some tries in searching throughour the net and some help that I got directly from my colleague at work, I found this solution
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.