Hi,
I'm using GZipStream to comopress a database, before compress the database size is about 300K, but after compress, it become 600K. Why it gets bigger size after compress? below are the code.
I'm using GZipStream to comopress a database, before compress the database size is about 300K, but after compress, it become 600K. Why it gets bigger size after compress? below are the code.
Code:
Dim ZipFileName As String = Nothing
ZipFileName = DBbackup.Substring(0, DBbackup.LastIndexOf("\") + 1) & FileName
Dim srcFile As FileStream = File.OpenRead(ZipFileName)
Dim desFile As FileStream = File.Create(ZipFileName & ".zip")
Dim compStream As New GZipStream(desFile, CompressionMode.Compress)
Dim theByte As Integer = srcFile.ReadByte()
While theByte <> -1
compStream.WriteByte(CType(theByte, Byte))
theByte = srcFile.ReadByte()
End While
srcFile.Dispose()
desFile.Dispose()
My.Computer.FileSystem.DeleteFile(ZipFileName)