Board index » delphi » Running SQL Server DTS Packages from Delphi

Running SQL Server DTS Packages from Delphi

Hi, I am developing an app. that would manage
some DTS packages stored in SQL Server. I intalled
the ActiveX components necessary, was able to connect
to the DTS Package I had saved in SQL Server using the
TPackage.LoadFromSQLServer procedure, and listed all
the connections, steps and tasks in the package. But when
I try to execute it, I get this "Run-Time Error -2177221499 (80040005)
Provider generated code execution exception: EXCEPTION_ACCESS_VIOLATION".
Then I looked it up on the web and found some solutions
for this for VB developers. The first one was to set all
the ExecuteInMainThread proprierty of each step to true and
that didn't work. The other was putting some dummy code
for every package event and use the WithEvent proprierty
VB has. I used the dummy code but I don't know how exactly
the WithEvent works, but all the package events were ther
already, and that didn't work either...
So, HELP, please...

Thiago

 

Re:Running SQL Server DTS Packages from Delphi


In article <973v53$n...@bornews.inprise.com>, thiago_ba...@yahoo.com
says...
Quote
> Hi, I am developing an app. that would manage
> some DTS packages stored in SQL Server.

I've done a little with DTS from Delphi.  Never encountered that
message, though.

What version of SQL Server?
What version of Delphi?
What operating system version?
Do you have the Windows Script Host installed?  If so, what version?

CW

Re:Running SQL Server DTS Packages from Delphi


Does the package run when executed outside of Delphi?

Are you really really really sure you have the execute On Main thread thing
set? If the package runs from EM or the DTS Designer and not from Program
Code it is usually the threading problem.

-Euan

Quote
"Thiago" <thiago_ba...@yahoo.com> wrote in message

news:973v53$n406@bornews.inprise.com...
Quote
> Hi, I am developing an app. that would manage
> some DTS packages stored in SQL Server. I intalled
> the ActiveX components necessary, was able to connect
> to the DTS Package I had saved in SQL Server using the
> TPackage.LoadFromSQLServer procedure, and listed all
> the connections, steps and tasks in the package. But when
> I try to execute it, I get this "Run-Time Error -2177221499 (80040005)
> Provider generated code execution exception: EXCEPTION_ACCESS_VIOLATION".
> Then I looked it up on the web and found some solutions
> for this for VB developers. The first one was to set all
> the ExecuteInMainThread proprierty of each step to true and
> that didn't work. The other was putting some dummy code
> for every package event and use the WithEvent proprierty
> VB has. I used the dummy code but I don't know how exactly
> the WithEvent works, but all the package events were ther
> already, and that didn't work either...
> So, HELP, please...

> Thiago

Re:Running SQL Server DTS Packages from Delphi


 I'm using Delphi 5 and SQL Server 7, but I'm not sure what SP
the SQL Server on the server is using. Do you think that could be
a problem, if the server does not have any SP installed? Also, I don't
think I have the Windows Scripting Host installed. Should I install
it?

 Thank you for the help.

Quote
"Clark Wilson" <wilso...@my-deja.com> wrote in message

news:MPG.14ff6d6334b9886989680@newsgroups.borland.com...
Quote
> In article <973v53$n...@bornews.inprise.com>, thiago_ba...@yahoo.com
> says...
> > Hi, I am developing an app. that would manage
> > some DTS packages stored in SQL Server.
> I've done a little with DTS from Delphi.  Never encountered that
> message, though.

> What version of SQL Server?
> What version of Delphi?
> What operating system version?
> Do you have the Windows Script Host installed?  If so, what version?

> CW

Re:Running SQL Server DTS Packages from Delphi


The package runs fine if executed from DTS Designer and from
a SQL Server Job...
Yes, I did it for each step on SQL Server's package editor and
also in code to be sure, here it is:

moPackage.LoadFromSQLServer('LORNE-IIS','sa','',DTSReposFlag_Default,'','','
','TestImpor3');
      ...
      for i:=1 to moPackage.Steps.Count do begin
        moPackage.Steps.Item(i).ExecuteInMainThread := True;
      end;
      ...
      moPackage.Execute;  // Here's where I get the error...

Quote
"Euan Garden" <euan.gar...@spicedham.usa.net> wrote in message

news:974o94$97t8@bornews.inprise.com...
Quote
> Does the package run when executed outside of Delphi?

> Are you really really really sure you have the execute On Main thread
thing
> set? If the package runs from EM or the DTS Designer and not from Program
> Code it is usually the threading problem.

> -Euan

> "Thiago" <thiago_ba...@yahoo.com> wrote in message
> news:973v53$n406@bornews.inprise.com...
> > Hi, I am developing an app. that would manage
> > some DTS packages stored in SQL Server. I intalled
> > the ActiveX components necessary, was able to connect
> > to the DTS Package I had saved in SQL Server using the
> > TPackage.LoadFromSQLServer procedure, and listed all
> > the connections, steps and tasks in the package. But when
> > I try to execute it, I get this "Run-Time Error -2177221499 (80040005)
> > Provider generated code execution exception:

EXCEPTION_ACCESS_VIOLATION".

- Show quoted text -

Quote
> > Then I looked it up on the web and found some solutions
> > for this for VB developers. The first one was to set all
> > the ExecuteInMainThread proprierty of each step to true and
> > that didn't work. The other was putting some dummy code
> > for every package event and use the WithEvent proprierty
> > VB has. I used the dummy code but I don't know how exactly
> > the WithEvent works, but all the package events were ther
> > already, and that didn't work either...
> > So, HELP, please...

> > Thiago

Other Threads