in Search
 
Home Blogs Forums Marketplace Files
 
 
 

Copy Alchemy Database Item Failed

Last post 08-27-2008, 7:06 PM by Yao. 1 replies.
Sort Posts: Previous Next
  •  08-25-2008, 8:05 PM 14156

    Copy Alchemy Database Item Failed

    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

  •  08-27-2008, 7:06 PM 14168 in reply to 14156

    Re: Copy Alchemy Database Item Failed

    my program run good at alchemy 8.2 sp3 ,but can not run at alchemy 8.2 sp5.

     

View as RSS news feed in XML
  Privacy    Site Terms   Contact Administrator