dbTalk Databases Forums  

ASP.NET and C#

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


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



Reply
 
Thread Tools Display Modes
  #1  
Old   
J-T
 
Posts: n/a

Default ASP.NET and C# - 07-08-2005 , 02:39 PM






Is there a sample code or document which can giude me to the executing DTS
packages from an ASP.NET page.

Thanks



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: ASP.NET and C# - 07-09-2005 , 05:15 AM






You could do worse than to start at this page.

http://www.sqldev.net/dts/DotNETCookBook.htm

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"J-T" <J-T (AT) nospam (DOT) com> wrote

Quote:
Is there a sample code or document which can giude me to the executing DTS
packages from an ASP.NET page.

Thanks




Reply With Quote
  #3  
Old   
Ray5531
 
Posts: n/a

Default Re: ASP.NET and C# - 07-10-2005 , 01:06 AM



But this page dosen;t contain what I really ewant of its object model:-(

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
You could do worse than to start at this page.

http://www.sqldev.net/dts/DotNETCookBook.htm

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"J-T" <J-T (AT) nospam (DOT) com> wrote in message
news:u7ln6S$gFHA.2180 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Is there a sample code or document which can giude me to the executing
DTS packages from an ASP.NET page.

Thanks






Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: ASP.NET and C# - 07-10-2005 , 01:26 AM



Then you can have a look at some of our other articles.

Converting a DTS Package from Visual Basic 6.0 to Visual Basic .Net
(http://www.sqldts.com/default.aspx?264)


No "One Solution" is going to have everything you need and you may need to
cherry pick from a few. What exactly do you want to do in .Net with the DTS
object model and what have you tried so far?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Ray5531" <Ray5531 (AT) microsoft (DOT) com> wrote

Quote:
But this page dosen;t contain what I really ewant of its object model:-(

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:%23ZlcH8GhFHA.3436 (AT) tk2msftngp13 (DOT) phx.gbl...
You could do worse than to start at this page.

http://www.sqldev.net/dts/DotNETCookBook.htm

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"J-T" <J-T (AT) nospam (DOT) com> wrote in message
news:u7ln6S$gFHA.2180 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Is there a sample code or document which can giude me to the executing
DTS packages from an ASP.NET page.

Thanks








Reply With Quote
  #5  
Old   
J-T
 
Posts: n/a

Default Re: ASP.NET and C# - 07-10-2005 , 08:18 PM



Hi Allan,

I think I found what I want .I used a wrapper around its objects model and
now successfully load all the DTS packages in the database server I
want.However there is a big problem ,when I try to execute my package the
OnQueryCancel method is called unexpectedly and package dosen;t get
executed.There is a KB for that at
http://support.microsoft.com/kb/321525/EN-US/
but it is exactly what I am doing Look at my code:

using System;
using Microsoft.SQLServer.DTSPkg80;
using System.Runtime.InteropServices;

namespace Company.Business.ClassFiles.DTS
{

public class DTSIntrop
{

private string databaseServer;

public DTSIntrop(string databaseServer)
{
this.databaseServer=databaseServer;

}

public PackageInfos GetPackageNames(bool returnLastVersion)
{
ApplicationClass application = new ApplicationClass();
PackageSQLServer pkgSQLServer =
application.GetPackageSQLServer(this.databaseServe r,"","",DTSSQLServerStorageFlags.DTSSQLStgFlag_Use TrustedConnection);
PackageInfos pkgInfos =
pkgSQLServer.EnumPackageInfos("",returnLastVersion , "");

return pkgInfos;
}

public void ExecutePackage(string packageName)
{

try
{
Package2Class package = new Package2Class();
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);
CnnctPt.Advise(null, out iCookie);
object pVarPersistStgOfHost = null;

package.LoadFromSQLServer(this.databaseServer, null, null,
DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedC onnection, null,
null, null, packageName, ref pVarPersistStgOfHost);

package.Execute();
package.UnInitialize();
package = null;
CnnctPt.Unadvise(iCookie); //a connection that is created by
IConnectionPoint.Advise must be closed by calling IConnectionPoint.Unadvise
to avoid a memory leak
}

catch(System.Runtime.InteropServices.COMException ex)
{
Exception nEx=new Exception(String.Format("COMException {0}\n{1}\n{2}",
ex.ErrorCode, ex.Message, ex.StackTrace),ex);
throw nEx;
}

catch(System.Exception ex)
{
Exception nEx=new Exception(String.Format("Exception\n{0}\n{1}",
ex.Message, ex.StackTrace),ex);
throw nEx;
}

}
}


internal class PackageEventsSink :
Microsoft.SQLServer.DTSPkg80.PackageEvents
{
static string packageStatus="Not initialized";

public void OnQueryCancel(string EventSource, ref bool pbCancel)
<---***Every time I try to execute a package this method is called twice and
package dosen't get executed****
{
packageStatus = string.Format("OnQueryCancel({0})", EventSource );
pbCancel = false;
}
public void OnStart(string EventSource)
{
packageStatus = string.Format("OnStart({0})" ,EventSource);
}
public void OnProgress(string EventSource, string ProgressDescription, int
PercentComplete, int ProgressCountLow, int ProgressCountHigh)
{
packageStatus = string.Format("OnProgress({0})",EventSource);
}
public void OnError(string EventSource, int ErrorCode, string Source,
string Description, string HelpFile, int HelpContext, string
IDofInterfaceWithError, ref bool pbCancel)
{
packageStatus = string.Format("OnError({0})",EventSource);
}
public void OnFinish(string EventSource)
{
packageStatus = string.Format("OnFinish({0})",EventSource);
}

} // class PackageEventsSink : DTS.PackageEvents

}

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Then you can have a look at some of our other articles.

Converting a DTS Package from Visual Basic 6.0 to Visual Basic .Net
(http://www.sqldts.com/default.aspx?264)


No "One Solution" is going to have everything you need and you may need to
cherry pick from a few. What exactly do you want to do in .Net with the
DTS object model and what have you tried so far?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Ray5531" <Ray5531 (AT) microsoft (DOT) com> wrote in message
news:ulJ27VRhFHA.3436 (AT) tk2msftngp13 (DOT) phx.gbl...
But this page dosen;t contain what I really ewant of its object model:-(

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:%23ZlcH8GhFHA.3436 (AT) tk2msftngp13 (DOT) phx.gbl...
You could do worse than to start at this page.

http://www.sqldev.net/dts/DotNETCookBook.htm

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"J-T" <J-T (AT) nospam (DOT) com> wrote in message
news:u7ln6S$gFHA.2180 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Is there a sample code or document which can giude me to the executing
DTS packages from an ASP.NET page.

Thanks










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.