Link to home
Start Free TrialLog in
Avatar of jackjohnson44
jackjohnson44

asked on

open a file that was saved to a database in .net

I have a file that I save to a database in a win form 2005 vb.net application.

I have a dataset with a file in a variable.
I show the file name, size, and date in a grid.  I want to open the file so the user can see it when they click on the grid.  I can handle verything except actually opening the file.

How do I do this?

CREATE TABLE [Banks].[tblBankAttachments](
      [BankAttachmentGUID] [PCA].[UDT_GUID] NOT NULL,
      [BankGUID] [PCA].[UDT_GUID] NOT NULL,
      [Filename] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
      [Filedescription] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
      [FileSize] [int] NOT NULL,
      [FileText] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [CreatedOn] [datetime] NOT NULL,
      [CreatedBy] [nvarchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
Avatar of Jeff Certain
Jeff Certain
Flag of United States of America image

Do you know what type of file you've saved?
Avatar of jackjohnson44
jackjohnson44

ASKER

not 100%, maybe excel, maybe pdf, maybe word, possibly something else, but that would be a good start.
ASKER CERTIFIED SOLUTION
Avatar of Jeff Certain
Jeff Certain
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
but the file is in a dataset.
I guess I could save it temporarily, but don't want to.
Isn't there a way to do it from the ds?
At a guess, you'd have to read the file data into a memory stream of some sort. Then you'd have to find out what kind of file it is, spin up the appropriate application and pass the memory stream to it.

Frankly, I'm not even sure where I'd start on that one.
I keep the file name so I can find the extension.

Assuming that all files are excel (.xls) how can I do it without downloading the file to the users machine?

If I am forced to save it someplace, is there a place I can save it that is only temporary?  Some sort of temp folder?
any news on this one?  I really need to figure out how to open an excel file without saving it to a file first.