Because you are passing values to Global Variables I would check that the
DataType supports the values you are passing.
Also. Why bother with Global Variable values when you can change whatever
you want iside the package through code anyway and as you say the package
executes fine if you directly pass the values to the statements.?
--
--
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals -
http://www.sqlpass.org [quoted text, click to view] "Kaspian" <alipow@nospam_wp.pl> wrote in message
news:D7626F70-C27F-424B-867B-5A2742988E91@microsoft.com...
> Thanks Alan for Your prompt reply!
>
> As a matter of fact, I already succeded in executing my first package from
within an application (.net windows form, visual basic), after reading the
article from You and other articles.(Thank You!)
[quoted text, click to view] > It is the parameters which bother me. I am using this code (there are no
security issues, the package runs fine without parameters)
>
> Sub btn_run_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_run.Click
> Dim pkg As DTS.Package2
> Dim objGlobal1 As DTS.GlobalVariable
>
> Try
> pkg = New DTS.Package2()
>
> pkg.LoadFromSQLServer("servername", "username", "password",
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "", "packagename",
Nothing)
[quoted text, click to view] > For Each objGlobal1 In pkg.GlobalVariables
> MessageBox.Show(objGlobal1.Name)
> If objGlobal1.Name = "Date1" Then
> objGlobal1.Value = txtdate.Text
> objGlobal1.Value = DateTime.ToString(objGlobal1)
> MessageBox.Show(objGlobal1.Value)
> ElseIf objGlobal1.Name = "Date2" Then
> objGlobal1.Value = txtdate2.Text
> objGlobal1.Value = DateTime.ToString(objGlobal1)
> MessageBox.Show(objGlobal1.Value)
> End If
> Next
> pkg.Execute()
> pkg.UnInitialize()
> pkg = Nothing
>
> Catch exc As System.Runtime.InteropServices.COMException
> MessageBox.Show(exc.Message)
> Catch exc As Exception
> MessageBox.Show(exc.Message)
>
> End Try
> End Sub
>
>
> As I mentioned, I have no problems whatsoever with executing the package
per se from this code. It is when I introduce the global variables that I
receive a package execution error. The global variables are declared and
mapped to the parameters in the sql string that retrieves the data from our
oracle database.
[quoted text, click to view] > I constantly get the message: "Parameter is incorrect" within a package
execution log.
> When I insert the two values I am trying to pass as paramters directly
into the select statement of the data pump task, the package executes
beautifully.
[quoted text, click to view] > I suppose there is a problem with the format of the values I want to pass
as parameters. I just do not know where else to look - what else can go
wrong with passing parameters?
[quoted text, click to view] > Do You have any idea where I should look?
>
> Kind regards,
>
> Kaspian