I'm trying to get the same BLOB beginning with 0x (like 0x12345679....) in C# that i get in VB6... the problem is that the old VB6 program is still used, and i have to create in C# a program that will transform pdf files in BLOB before inserting them into the database... I found the VB6 code (or i hope i found it, because i'm extremely new to VB6), that uses AppendChunk method to import (create and import???) the BLOB...
Dim rs, rs2 As Recordset
Dim arrData() As Byte, strFile As String
Const BlockSize = 10240
srcFile = FreeFile
Dim fullname
fullname = IMPORTFOLDER & strFile // This is the path + the file
Open fullname For Binary Access Read As srcFile
FileLength = LOF(srcFile) // Get the total size of the file
NumBlocks = FileLength \ BlockSize // Set number of chunks
LeftOver = FileLength Mod BlockSize // Set number of remaining bytes
ReDim arrData(LeftOver)
Get srcFile, , arrData()
rs.AddNew
myDocID = NextDocID()
rs!DocumentId = myDocID
rs("DocumentData").AppendChunk arrData()
ReDim arrData(BlockSize)
For i = 1 To NumBlocks
Get srcFile, , arrData()
rs("DocumentData").AppendChunk arrData()
Next i
rs.Update
I tried to use the method from here but it doesn't work... I used NHibernate to automatically create the BLOB and insert it into a database, and seemed that the result i was getting was very close tho the one the old program in VB6 does, but again.. it wasn't the same :( Please, tell me, is it possible to get the same BLOB in C# that i'm getting in VB6, and what would be the code in C#? At least an idea.. please.. Thank You in advance.