WinForm Retrieve Excel file from SQL Server and Open it

J

Jason Huang

Hi,

My Excel .xls files are stored as image on the SQL Server.
Now I would like to retrieve the .xls files and open it.
I use the FileStream and write it on client pc's C;\.
How do I open it in the C# code, so that user won't need to go the file
explorer to open?
Thanks for help.


Jason
 
F

Family Tree Mike

Jason said:
Hi,

My Excel .xls files are stored as image on the SQL Server.
Now I would like to retrieve the .xls files and open it.
I use the FileStream and write it on client pc's C;\.
How do I open it in the C# code, so that user won't need to go the file
explorer to open?
Thanks for help.


Jason

Try using Process.Start(@"c:\somefile.xls"); This opens the file with
the default application, which would be Excel.
 
J

Jeff Johnson

Try using Process.Start(@"c:\somefile.xls"); This opens the file with the
default application, which would be Excel.

Hate to sound obvious, but it should be mentioned that the file will need to
be SAVED somewhere first; you won't simply be able to open it from memory.
 
F

Family Tree Mike

Jeff Johnson said:
Hate to sound obvious, but it should be mentioned that the file will need to
be SAVED somewhere first; you won't simply be able to open it from memory.

The OP said that they use the FileStream and write it on the clients pc. I
took that to mean they did the obvious step.

Mike
 
J

Jeff Johnson

The OP said that they use the FileStream and write it on the clients pc.
I
took that to mean they did the obvious step.

Ack! Completely missed that.
 
J

Jason Huang

It helps!
Thank you very much!


Family Tree Mike said:
Try using Process.Start(@"c:\somefile.xls"); This opens the file with the
default application, which would be Excel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top