Results 1 to 21 of 21

Thread: [RESOLVED] Decompression doesnt work properly

Hybrid View

  1. #1
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Decompression doesnt work properly

    The code I posted earlier works perfectly for me whether the RTB contains an image or just text. Did you test that code specifically?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  2. #2

    Thread Starter
    Fanatic Member sridharavijay's Avatar
    Join Date
    Sep 2002
    Location
    http://www.vijaysridhara.in
    Posts
    589

    Re: Decompression doesnt work properly

    Well I am using PostgreSQL as backend... and here is the code I am using... let me also save it to a file and check it instead of table...
    vb.net Code:
    1. Friend Function CompressBytes(ByVal text As String) As Byte()
    2.         Try
    3.             Using store As New IO.MemoryStream
    4.                 Using compressor As New System.IO.Compression.GZipStream(store, IO.Compression.CompressionMode.Compress)
    5.                     Using writer As New IO.StreamWriter(compressor)
    6.                         store.Position = 0
    7.                         writer.Write(text)
    8.                         Return store.GetBuffer()
    9.                     End Using
    10.                 End Using
    11.             End Using
    12.         Catch ex As Exception
    13.             DE(ex)
    14.         End Try
    15.     End Function
    16.     Friend Function DecompressBytes(ByVal bytes() As Byte) As String
    17.         Try
    18.             Using store As New IO.MemoryStream(bytes)
    19.                 Using decompressor As New IO.Compression.GZipStream(store, IO.Compression.CompressionMode.Decompress)
    20.                     store.Position = 0
    21.                     Using reader As New IO.StreamReader(decompressor)
    22.                         Return reader.ReadToEnd
    23.                     End Using
    24.                 End Using
    25.             End Using
    26.         Catch ex As Exception
    27.             DE(ex)
    28.         End Try
    29.     End Function

  3. #3

    Thread Starter
    Fanatic Member sridharavijay's Avatar
    Join Date
    Sep 2002
    Location
    http://www.vijaysridhara.in
    Posts
    589

    Re: Decompression doesnt work properly

    You are right... it works on the fly... I am not sure why it isnt working in a DB scenario...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width