Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-04-10
7
Medium Priority
?
171 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 2000 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
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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)…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

609 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