Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

asp.net error

Options
  • 12-04-2010 11:23am
    #1
    Closed Accounts Posts: 1,759 ✭✭✭


    Hi,

    Executing an SSIS package within .net, which has a parameter.

    I am getting an error, you're help would be appreciated.
    "Error trying to write to a read-only variable, "CancelEvent""

    The code I have is just this.

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim app As Application = New Application()
    ' Load the packages.
    Dim p1 As Package = app.LoadFromSqlServer("ImportJobPKG", "myserver", Nothing, Nothing, Nothing)

    p1.Variables(
    0).Value = FileUpload1.PostedFile.FileName
    p1.Execute()
     
    End Sub


Comments

  • Closed Accounts Posts: 1,759 ✭✭✭Dr.Silly


    Dr.Silly wrote: »
    Hi,

    Executing an SSIS package within .net, which has a parameter.

    I am getting an error, you're help would be appreciated.
    "Error trying to write to a read-only variable, "CancelEvent""

    The code I have is just this.

    ProtectedSub Button1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles Button1.Click
    Dim app AsApplication = NewApplication()
    ' Load the packages.
    Dim p1 AsPackage = app.LoadFromSqlServer("ImportJobPKG", "myserver", Nothing, Nothing, Nothing)

    p1.Variables(
    0).Value = FileUpload1.PostedFile.FileName
    p1.Execute()
     
    EndSub

    the error is on this line btw.
    p1.Variables(0).Value = FileUpload1.PostedFile.FileName

    thanks


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Can you post the error details?


  • Closed Accounts Posts: 1,759 ✭✭✭Dr.Silly


    Evil Phil wrote: »
    Can you post the error details?

    Thanks Evil Phil. Here they are


  • Closed Accounts Posts: 1,759 ✭✭✭Dr.Silly


    got it sorted, code below in case anyone else has same issue.


    Dim app As Application = New Application()
    ' Load the packages.
    Dim p1 As Package = app.LoadFromSqlServer("Package", "myServer", Nothing, Nothing, Nothing)
    Dim vars As Variables
    vars = p1.Variables
    vars(
    "myPath").ReadOnly = False
    p1.VariableDispenser.LockOneForWrite("myPath", vars)
    vars(
    "myPath").Value = FileUpload1.PostedFile.FileName
    vars.Unlock()
    p1.Execute()


Advertisement