Write binary data to database



Hi all..

I have converted text document to blob(binary large objects) in an
array binaryArray [], now the data needs to be saved in database table

The following code does not save the binary array in the database
field 'Document'.. dont know whats wrong..
im new to vb.net and datasets..

kindly help me!

Dim len As Integer

Dim fs As FileStream = New FileStream(FileName,
FileMode.OpenOrCreate, FileAccess.Read)
len = CInt(fs.Length) ' convert from long to type int
Dim binaryArray() As Byte = New Byte(len - 1) {}
fs.Read(binaryArray, 0, len)

'---- check code

Dim name As String
name = "af"

Dim tdsDocumentObj As New tdsDocument.DokumentDataTable

Dim something As tdsDocument.DokumentRow = Nothing

something = tdsDocumentObj.NewDokumentRow

something.Document = (binaryArray)



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question