unable to take data from database and place into a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Newbie19
    New Member
    • Jun 2007
    • 122

    unable to take data from database and place into a file

    I'm trying to take attachments that were saved on a database and place them on a harddrive. However, I can create the file, however when I open the file I get system.Byte[] or image cannont be viewed on the files.

    Here is the code I am using:

    public void saveattachment( String MKS_attachmentN ame, Byte[] MKS_attachmentC ontent)
    {

    StreamWriter sw = new StreamWriter("C :/MKSattachments/" + MKS_attachmentN ame);

    sw.Write(MKS_at tachmentContent );

    sw.Close();

    }

    I stream the attachment Name into the file name and the write the contents of the file using the .write() method. The MKS_attachmentC ontent is in the type Byte[], which I'm currently unfimiliar with.

    Any help I would be grateful for.

    Thank you in advance,

    Newbie19
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    This appears to be Java. I am moving this to the Java forum.

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      Originally posted by weaknessforcats
      This appears to be Java. I am moving this to the Java forum.
      In what package is StreamWriter defined?

      Comment

      • Newbie19
        New Member
        • Jun 2007
        • 122

        #4
        Originally posted by weaknessforcats
        This appears to be Java. I am moving this to the Java forum.

        Its not Java, its C#

        Comment

        • BigDaddyLH
          Recognized Expert Top Contributor
          • Dec 2007
          • 1216

          #5
          Originally posted by Newbie19
          Its not Java, its C#
          I feel so dirty! At least 20 characters of dirty.

          Comment

          • Newbie19
            New Member
            • Jun 2007
            • 122

            #6
            [QUOTE=BigDaddyL H]I feel so dirty! At least 20 characters of dirty.[/QU

            ha, yeah Microsoft's rip off of Java.

            Comment

            Working...