Open a file save as byte

  • Thread starter Thread starter Nicolas
  • Start date Start date
N

Nicolas

How do I open a file which is saves into the database as byte()

So far, I got this and it's working

Dim myDoc as Byte()
myDoc = CType(dbDataRow("Document"), Byte())

From there how do I open this so the user can review this file.

Thank for the help.
 
' Convert the byte array to a string

Dim ascii As ASCIIEncoding = new ASCIIEncoding();

Dim strText As String = ascii.GetString(myDoc);
 
Do you know the type of data in your byte array or the original file name ?

if so you could just write your byte array out to a temp file and then use
Process.Start(tempfilename) so long as it has the correct extension and it
is mapped in windows.
 
* "Nicolas said:
How do I open a file which is saves into the database as byte()

So far, I got this and it's working

Dim myDoc as Byte()
myDoc = CType(dbDataRow("Document"), Byte())

From there how do I open this so the user can review this file.

You will have to save it to disk using 'System.IO.FileStream' and then
use 'System.Diagnostics.Process.Start' to open the file.
 
So I should Save the Type of the file within the database right.
and then how do you go to create the file (byte array out to a temp file)
because i don't know if it is a text or graphic or media file

Thank again
 
Back
Top