Write binary data to database


M

Muhs

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
'Dokumet'

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)
fs.Close()


'---- 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)

tdsDocumentObj.AcceptChanges()
 
Ad

Advertisements


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

Top