dbTalk Databases Forums  

C# and DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss C# and DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Simone Chemelli
 
Posts: n/a

Default C# and DTS - 01-18-2005 , 09:08 AM






I'm, trying to create a ASP page that launch a DTS packed after setting a
globla variable for the import file name.
I need to import only today (2005-01-18.CSV) file, so the DTS first delete
today records than import the new file.

If I use a fixed file name evrything is fine, but using a global variable in
my DTS package I receive an error:

Event Source : DTSStep_DTSDataPumpTask_1
Error Code : -2147024891
Source : Microsoft Data Transformation Services (DTS) Package
Description : Access is denied.
HelpFile : sqldts80.hlp
HelpContext : 1100
InterfaceError {10020306-EB1C-11CF-AE6E-00AA004A34D5}


I think the issue can be due to two different reasons:

1) The variable is not passed correctly to the script, but also DTSRUN fails
in the same way using /A....parameter

2) Security access to the file system by ASPNET user, but if I force it
using A:\, I can see the led light on

Looking forward for an idea or fix. Regards,

Simone



Reply With Quote
  #2  
Old   
Simone Chemelli
 
Posts: n/a

Default Re: C# and DTS - 01-18-2005 , 12:24 PM






I went on testing and both my assumption are wrong...

Quote:
I think the issue can be due to two different reasons:

1) The variable is not passed correctly to the script, but also DTSRUN
fails in the same way using /A....parameter
Using the correct sintax in DTSRUN command line or using DTSRUNUI works
fine, the parameter is passed correctly and the DTS packages does what it
should...

Quote:
2) Security access to the file system by ASPNET user, but if I force it
using A:\, I can see the led light on
If I give a floppy or a fixed drive in the path it always works when the
fiel is there...

Quote:
Looking forward for an idea or fix. Regards,

The only idea I can have is that the parameter is not passed corretly to the
activex script in the dts from the code. I put it the interesting part if
someone can see what I can't:

package = new PackageClass();
UCOMIConnectionPointContainer CnnctPtCont =
(UCOMIConnectionPointContainer) package;
UCOMIConnectionPoint CnnctPt;
PackageEventsSink PES = new PackageEventsSink ();
Guid guid = new Guid("10020605-EB1C-11CF-AE6E-00AA004A34D5"); // UUID
of PackageEvents Interface
CnnctPtCont.FindConnectionPoint(ref guid, out CnnctPt);
int iCookie;
CnnctPt.Advise(PES, out iCookie);
object pVarPersistStgOfHost = null;

//Retrieve global settings from the Configuration File
string serverName = ConfigurationSettings.AppSettings["serverName"];
string userName = ConfigurationSettings.AppSettings["userName"];
string password = ConfigurationSettings.AppSettings["password"];
string packageName = ConfigurationSettings.AppSettings["packageName"];

package.LoadFromSQLServer(serverName, userName, password,
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, null, null, null,
packageName, ref pVarPersistStgOfHost);

//Loop through all the Global variables and remove the variables that
are of type string
foreach(GlobalVariable global in package.GlobalVariables)
{
if (global.Name == "gFilePath")
{
package.GlobalVariables.Remove(global.Name);
}
}

//Re-add all the global variables that are of type string
package.GlobalVariables.Add("gFilePath","A:\\SR050 118.CSV");

//Execute the Package
package.Execute();
package.UnInitialize();
package = null;
CnnctPt.Unadvise(iCookie);

----------------------------------------------------------------------------------------------------------
The analogue command in DTSRUN instead works smothly:

DTSRun /S"(local)" /U"xxxxxxxxx" /P"xxxxxxxxxxx" /N"Aggiorna3"
/A"gFilePath":"8"="A:\SR050118.CSV"

-----------------------------------------------------------------------------------------------------------




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.