Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

ParameterCountMisMatch passing array to Second/Third Domain

Back to Forum: Tech Off
  • User profile image
    qwert231

    Okay, my code needs to call functions in a Services.DLL that may be unloaded and loaded. So far this has worked, one issue I'm getting is trying to pass paramaters to a function into the domain.

    I have my primary domain, which opens a Proxy domain. The Proxy domain does the grunt work talking to the Services.DLL that will be unloaded, by opening a special Domain for the Services.DLL.

    The Proxy domain does an Invoke on the Services.DLL, passing in a parameter. It's just a string. However, I get a ParameterCountMismatch error when it tries to do the Invoke.

    '----- Primary domain (opens a Proxy domain)

    Private Sub Backup()
     
    Dim thisPath(0) As String
     
    Try
     
    thisPath(0) = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Remove(0, 6) & "\DMData.bak"

     Call Proxy.DoBackup(thisPath)

     Call Me.UpdateStatus("Data has been backed up successfully.")
     Catch ex As Exception
      
    Call Me.ReportError("Backup", ex.ToString)
      MsgBox("There was an error during backup. Please contact Century Color.")
     End Try

    End Sub


    '----- Proxy Code (Opens my Services domain)
    Public Sub DoBackup(ByVal thisPath() As String)
     
    Call Me.methBackup.Invoke(Me.objDsrvc, thisPath) '<--- This errors
    End Sub

    '----- Method that should be called (In the Services domain)
    Public Sub BackupData(ByVal thisPath As String)
     
    Try
     
    Me.cmdRunBackup.Connection.ConnectionString = "uid=xxxxxx;pwd=xxxxxxxx;data source=" & conServer & ";initial catalog=DataMatch3"

     
    'Check and open the conneection
     
    If Me.cmdRunBackup.Connection.State <> ConnectionState.Open Then Me.cmdRunBackup.Connection.Open()
     
    Me.cmdRunBackup.Parameters("@dumpPath").Value = thisPath
      
      'Fire away
     
    Me.cmdRunBackup.ExecuteNonQuery()
     
    Catch ex As Exception
     
    Throw New ApplicationException(ex.ToString)
     
    Finally
     
    If Me.cmdRunBackup.Connection.State <> ConnectionState.Closed Then Me.cmdRunBackup.Connection.Close()
     
    End Try
    End Sub

    Edit: I've fixed the above code, it works now.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.