Solved

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

Posted on 2007-04-10
7
161 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
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

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

Author Comment

by:jackjohnson44
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:jackjohnson44
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now