• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

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
0
jackjohnson44
Asked:
jackjohnson44
  • 4
  • 3
1 Solution
 
Jeff CertainCommented:
Do you know what type of file you've saved?
0
 
jackjohnson44Author Commented:
not 100%, maybe excel, maybe pdf, maybe word, possibly something else, but that would be a good start.
0
 
Jeff CertainCommented:
You can use  System.Diagnostics.Process.Start("c:\somepath\somefile.txt") to launch an application. As long as the file extension is registered with the OS, this should be all you need.
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
jackjohnson44Author Commented:
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?
0
 
Jeff CertainCommented:
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.
0
 
jackjohnson44Author Commented:
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?
0
 
jackjohnson44Author Commented:
any news on this one?  I really need to figure out how to open an excel file without saving it to a file first.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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