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].[tblBankAttachment s](
[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
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].[tblBankAttachment
[BankAttachmentGUID] [PCA].[UDT_GUID] NOT NULL,
[BankGUID] [PCA].[UDT_GUID] NOT NULL,
[Filename] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_
[Filedescription] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_
[FileSize] [int] NOT NULL,
[FileText] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_
[CreatedOn] [datetime] NOT NULL,
[CreatedBy] [nvarchar](30) COLLATE SQL_Latin1_General_CP1_CI_
Do you know what type of file you've saved?
ASKER
not 100%, maybe excel, maybe pdf, maybe word, possibly something else, but that would be a good start.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
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.
Frankly, I'm not even sure where I'd start on that one.
ASKER
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?
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?
ASKER
any news on this one? I really need to figure out how to open an excel file without saving it to a file first.