Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 DTS Execute Problem

Author  Topic 

sourvil
Starting Member

14 Posts

Posted - 2007-08-27 : 09:49:00
Hi all,
My dts fails in step 3 when i run it from asp.net. But it works fine in when i run in Designer.
In step 3, it reads some data from a text source (on a shared place). And it gives me error :

Step Error Source: Microsoft Data Transformation Services Flat File Rowset Provider
Step Error Description:Error opening datafile: Logon failure: unknown user name or bad password.

Step Error code: 80004005
Step Error Help File:DTSFFile.hlp
Step Error Help Context ID:0


I know that when i run it on Designer, it works by my current Windows Loginname. And when i execute dts in asp.net page, it works by SqlAgent's login name. And also i made SqlAgent's Username (as a Domain UserName) a Local Admin in the file shared server.

Any idea?


Regards..

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-27 : 22:14:16
Should it run under web service account in asp? What's connection string in asp?
Go to Top of Page

sourvil
Starting Member

14 Posts

Posted - 2007-08-28 : 01:33:13
I use Interop.DTS class. And my application runs with my AD username.
It works fine when i run in designer but it fails when i call it from aspx page.

Any idea?


Regards.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-28 : 22:12:11
How do you connect to sql in asp?
Go to Top of Page

sourvil
Starting Member

14 Posts

Posted - 2007-08-29 : 05:04:01
My ExecuteDts Function is :

public static void ExecuteDTS(string PackageName, params object[] DtsVariableValues)
{
string ServerName = ConnectionNames.OlapServerName;
string ServerUserName = ConnectionNames.OlapUserName;
string ServerPassword = ConnectionNames.OlapPassword;

object pVarPersistStgOfHost = null;

DTS.PackageClass DtsPackage = new DTS.PackageClass();
DtsPackage.LoadFromSQLServer(ServerName, ServerUserName, ServerPassword, DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default
, null, null, null, PackageName, ref pVarPersistStgOfHost);
try
{
string[] DtsVariableNames = new String[DtsPackage.GlobalVariables.Count];
int VariableIndex = 0;

DtsPackage.UseTransaction = true;
foreach (GlobalVariable global in DtsPackage.GlobalVariables)
{
DtsVariableNames[VariableIndex] = global.Name;
DtsPackage.GlobalVariables.Remove(global.Name);
VariableIndex++;
}
VariableIndex = 0;
foreach (String DtsVariableName in DtsVariableNames)
{
DtsPackage.GlobalVariables.AddGlobalVariable(DtsVariableName, DtsVariableValues.GetValue(VariableIndex));
VariableIndex++;
}
DtsPackage.Execute();
}
catch (Exception ex)
{
//Console.WriteLine(ex.Message);
}

finally
{
DtsPackage.UnInitialize();
DtsPackage = null;
}
}

i connect to server with 'sa' and 'password'. Any idea?

Regards..
Go to Top of Page
   

- Advertisement -