Open a file save as byte

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nicolas

    Open a file save as byte

    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.


  • Drew Berkemeyer

    #2
    Re: Open a file save as byte

    ' Convert the byte array to a string

    Dim ascii As ASCIIEncoding = new ASCIIEncoding() ;

    Dim strText As String = ascii.GetString (myDoc);



    "Nicolas" <nliebel@hotmai l.com> wrote in message
    news:%23VeIf2IV EHA.1292@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > 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.
    >
    >[/color]


    Comment

    • Greg Young

      #3
      Re: Open a file save as byte

      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(t empfilename) so long as it has the correct extension and it
      is mapped in windows.


      "Nicolas" <nliebel@hotmai l.com> wrote in message
      news:%23VeIf2IV EHA.1292@TK2MSF TNGP10.phx.gbl. ..[color=blue]
      > 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.
      >
      >[/color]


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Open a file save as byte

        * "Nicolas" <nliebel@hotmai l.com> scripsit:[color=blue]
        > 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.[/color]

        You will have to save it to disk using 'System.IO.File Stream' and then
        use 'System.Diagnos tics.Process.St art' to open the file.

        --
        Herfried K. Wagner [MVP]
        <URL:http://dotnet.mvps.org/>

        Comment

        • Nicolas

          #5
          Re: Open a file save as byte

          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


          "Greg Young" <greg.young@pla netbeach.com> wrote in message
          news:uwqcSBJVEH A.4064@TK2MSFTN GP11.phx.gbl...[color=blue]
          > Do you know the type of data in your byte array or the original file name[/color]
          ?[color=blue]
          >
          > if so you could just write your byte array out to a temp file and then use
          > Process.Start(t empfilename) so long as it has the correct extension and it
          > is mapped in windows.
          >
          >
          > "Nicolas" <nliebel@hotmai l.com> wrote in message
          > news:%23VeIf2IV EHA.1292@TK2MSF TNGP10.phx.gbl. ..[color=green]
          > > 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.
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...