I want to copy a item from database A to database B.If the item without annotation,HasAnnotation=False, then everything is ok.
But if the item with annotation ,HasAnnotation=True,then return a error.Error HRESULT E_FAIL has been returned from a call to a COM component.
Please help me...I am a Beginner of Alchemy SDK Developer
there are the codes:Visual Basic.Net 2005
Public Class Form1
Private oClnApp As Alchemy.Application
Private oAlDbSrcDb As Alchemy.Database
Private oAlDbDecDb As Alchemy.Database
Private oAlBuilder As Alchemy.Builder
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Set Alchemy Client Start
oClnApp = New Alchemy.Application
oClnApp.PutOptionsString("License", "Client", "IdxStation")
oClnApp.LoadOptionsFile()
oClnApp.Visible = False
'Set Alchemy Client End
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim SrcItem As Alchemy.Item
Dim DecItem As Alchemy.Item
oAlDbSrcDb = oClnApp.Databases("C:\SourceCodes\AlchemyDemoDB\yao test.ald")
oAlDbDecDb = oClnApp.Databases("C:\SourceCodes\AlchemyDemoDB\my.ald")
SrcItem = oAlDbSrcDb.GetItemByID(224)
If oAlDbSrcDb.GetItemByID(224).HasChildren Then
Me.Text = "Children"
End If
If oAlDbSrcDb.GetItemByID(224).HasAnnotation Then
Me.Text = "Annotation"
End If
oAlBuilder = oClnApp.NewBuilder(oAlDbDecDb)
oAlBuilder.BeginStreamData()
DecItem = oAlBuilder.BeginRecord(Nothing, Alchemy.AuPosEnum.auPosLastChild, "")
DecItem.Title = SrcItem.Title
DecItem.Field("File Name") = SrcItem.Field("File Name")
For Each oField As Alchemy.Field In oAlDbSrcDb.Fields
If (oField.FieldType = Alchemy.AuFieldTypeEnum.auFieldUserDefined) Then
Try
DecItem.Field(oField.Name) = SrcItem.Field(oField.Name)
Catch ex As Exception
End Try
End If
Next
oAlBuilder.AppendData(SrcItem.GetContent(0, SrcItem.Size, True), SrcItem.Size)
return a error...
'oAlBuilder.AppendData(SrcItem.GetContent(0, SrcItem.Size, False), SrcItem.Size)
everything is ok....
oAlBuilder.EndRecord()
oAlBuilder.EndStreamData()
End Sub
End Class