VB 6.0 com+ automation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhitam30111985
    New Member
    • Aug 2007
    • 112

    #1

    VB 6.0 com+ automation

    Hi all . i am trying to deploy a set of com+ components to create a server . M aim is to first delete all the existing components and replace them with new ones to avoid duplication ... Here is my code :




    [CODE=vb]
    Dim catalog As COMAdmin.COMAdm inCatalog
    Dim Applications As COMAdmin.COMAdm inCatalogCollec tion
    Dim Application As COMAdmin.COMAdm inCatalogObject
    Dim Components As COMAdmin.COMAdm inCatalogCollec tion
    Dim comps As COMAdmin.COMAdm inCatalogObject
    Dim ComDllName As COMAdmin.COMAdm inCatalogObject
    Dim Index As Integer


    Set catalog = New COMAdmin.COMAdm inCatalog
    Set Applications = catalog.GetColl ection("Applica tions")
    Call Applications.Po pulate

    For Each comps In Applications
    On Error Resume Next
    Dim orchapplication As Integer
    applicationname = InStr(1, comps.Name, "somename", vbTextCompare)
    If Not applicationname = 0 Then
    Set Components = Applications.Ge tCollection("Co mponents", comps.Key)
    Call Components.Popu late
    For Index = 0 To Components.Coun t - 1
    Components.Remo ve (Index)
    If Err Then
    AppendStatus (comps.Name & " " & Err.Description & " " & Err.Source)
    Else
    AppendStatus (Components.Ite m(Index).Value( "Name") & " was removed ")
    End If
    Next
    Components.Save Changes
    End If
    Next

    [/CODE]

    assume appentstatus function writes to a log file . whenever i try to remove the components as above . it logs the error as "Invalid procedure call or argument"


    any idea where i might be going wrong ?

    I have tried putting the following statement also before removing :
    Components(Inde x).Value("Delet able") = True

    But this doesnt work either

    Any help appreciated .
Working...