![]() | |
ConneXionInsertAttachment Method |
Namespace: ConneXion
![]() |
---|
It is advised to provide more fields to increase performance while Insert. For Example:
|
Dim oConneXion As New ConneXion.ConneXion Dim oAttachment As New ConneXion.Attachment Dim oResult As ConneXion.ConneXionResult Dim oFileInfo() As ConneXion.Attachment.FileInfoClass Dim oFile As System.IO.FileStream Dim binaryData() As Byte Dim lFileSize As Long oAttachment.TAMUserName = "EXEC" oAttachment.TAMPassword = "PSWD" ReDim oFileInfo(0) oFileInfo(0) = New ConneXion.Attachment.FileInfoClass oFileInfo(0).Category = "IMAGE" oFileInfo(0).Description = "Car Image" oFileInfo(0).FileName = "CarVBN809.jpg" oFile = New System.IO.FileStream("C:\CarVBN809.jpg", IO.FileMode.Open, IO.FileAccess.Read) lFileSize = FileLen("C:\CarVBN809.jpg") ReDim binaryData(lFileSize - 1) oFile.Read(binaryData, 0, lFileSize) oFile.Close() oFileInfo(0).Data = System.Convert.ToBase64String(binaryData) oAttachment.FileInfo = oFileInfo oAttachment.EntityKey = "C" oAttachment.EntityID = "ABBOJO1" oAttachment.UserDate = "20030909" oAttachment.AttachedBy = "EX" oResult = oConneXion.InsertAttachment(oAttachment) If oResult.Success Then MessageBox.Show("Insert Attachment is successful") txtResult.Text = oResult.Description & vbCrLf & "Record Number: " & oAttachment.RecordNumber Else txtResult.Text = "Insert Attachment is false" & vbCrLf & "Number: " & oResult.Number & vbCrLf & "Desc: " & oResult.Description & vbCrLf & "TAMErrorNumber: " & oResult.TAMErrorNumber & vbCrLf & "TAMErroDesc: " & oResult.TAMDescription End If