Write binary data to database

  • Thread starter Thread starter Muhs
  • Start date Start date
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()
 
Back
Top