Ok, I figured it out. Here's the code.
procedure TfmLoyalty.Button1Click(Sender: TObject);
var
FPackage : _Package;
strPackageName : string;
const
SQL_DATASOURCE = '(local)';
SQL_USERID = 'user';
SQL_PWD = 'somepassword';
begin
// this section gains access to the DTS package
FPackage := CoPackage.Create;
strPackageName := 'MyPackage';
FPackage.LoadFromSQLServer(
SQL_DATASOURCE,
WideString( SQL_USERID ),
WideString( SQL_PWD ),
DTSSQLStgFlag_Default,
WideString(''), //package password
WideString(''), //package guid
WideString(''), //package version guid
WideString( strPackageName ), //package name
EmptyParam //pVarPersistStgOfHost
);
// this line edits the variable
FPackage.GlobalVariables.Item('GVnumber1')._Set_Value(Edit1.text);
// this section saves the changes to the package on SQL Server
FPackage.SaveToSQLServer(
SQL_DATASOURCE,
WideString( SQL_USERID ),
WideString( SQL_PWD ),
DTSSQLStgFlag_Default,
WideString(''), //package owner password
WideString(''), //package operator password
WideString(''), //package category id
EmptyParam, //pVarPersistStgOfHost
TRUE //bReusePasswords
);
end;
[quoted text, click to view] "J O Holloway" <jholloway@pinncorp.com> wrote in message
news:OOaGit3VDHA.2268@TK2MSFTNGP11.phx.gbl...
> For MS SQL Server 2000 and Delphi 5, I would like to access and change
> global variables within a DTS package.
>
> I can access the package and execute it, but I'm unclear on the syntax for
> actually changing the global variable.
>
> Any help would be much appreciated.
>
>