Solved

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

Posted on 2007-04-10
7
166 Views
Last Modified: 2013-12-17
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
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 18885719
Do you know what type of file you've saved?
0
 

Author Comment

by:jackjohnson44
ID: 18889540
not 100%, maybe excel, maybe pdf, maybe word, possibly something else, but that would be a good start.
0
 
LVL 24

Accepted Solution

by:
Jeff Certain earned 500 total points
ID: 18889615
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jackjohnson44
ID: 18892972
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
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 18893021
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
 

Author Comment

by:jackjohnson44
ID: 18899549
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
 

Author Comment

by:jackjohnson44
ID: 18968609
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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question