dbTalk Databases Forums  

Error in execute DTS from OACreate method

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


Discuss Error in execute DTS from OACreate method in the microsoft.public.sqlserver.dts forum.



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

Default Error in execute DTS from OACreate method - 10-09-2003 , 07:27 AM






hi,
I need to execute DTS from OACreate Method. I got Error

Load Package Failed..

This is my code:

Declare @hr int, @oPKG int

EXEC @hr=sp_OACreate 'DTS.Package',@oPKG out
IF @hr <> 0
BEGIN
PRINT '*** Create Package object Failed'

RETURN
END

--- DTSSQLStgFlag_Default = 0

EXEC @hr=sp_OAMethod @oPKG,'LoadFromSQLServer
("Servername","Username","Password",0,,,,"Packagen ame")'
IF @hr <> 0
BEGIN
PRINT '*** Load Package failed'
RETURN
END

EXEC @hr = sp_OAMethod @oPKG, 'Execute'
IF @hr <> 0
BEGIN
PRINT '*** Execute failed'
--EXEC sp_displayoaerrorinfo @oPKG , @hr
RETURN
END


EXEC @hr=sp_OADestroy @oPKG
IF @hr <> 0
BEGIN
PRINT '*** DesTroy Package failed'

RETURN
END
What is the wrong in my code.

Thanks in advance,

Regards,
Prakash.

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

Default Re: Error in execute DTS from OACreate method - 10-09-2003 , 10:38 AM






Have a look here

http://www.databasejournal.com/featu...le.php/1459181

--
--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"Prakash" <dharmaprakash (AT) prudencetech (DOT) com> wrote

Quote:
hi,
I need to execute DTS from OACreate Method. I got Error

Load Package Failed..

This is my code:

Declare @hr int, @oPKG int

EXEC @hr=sp_OACreate 'DTS.Package',@oPKG out
IF @hr <> 0
BEGIN
PRINT '*** Create Package object Failed'

RETURN
END

--- DTSSQLStgFlag_Default = 0

EXEC @hr=sp_OAMethod @oPKG,'LoadFromSQLServer
("Servername","Username","Password",0,,,,"Packagen ame")'
IF @hr <> 0
BEGIN
PRINT '*** Load Package failed'
RETURN
END

EXEC @hr = sp_OAMethod @oPKG, 'Execute'
IF @hr <> 0
BEGIN
PRINT '*** Execute failed'
--EXEC sp_displayoaerrorinfo @oPKG , @hr
RETURN
END


EXEC @hr=sp_OADestroy @oPKG
IF @hr <> 0
BEGIN
PRINT '*** DesTroy Package failed'

RETURN
END
What is the wrong in my code.

Thanks in advance,

Regards,
Prakash.



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

Default Re: Error in execute DTS from OACreate method - 10-10-2003 , 04:14 AM



hi,
I look at the side.

In DTS, I Need to convert the MSAccess data to sqlServer.
So Establish a Connection. Before convert I take a backup.

So, Using the OACreate method, It execute only the Query.
That is, backup which is written in query is executed.

But convertion process didn't process.

Here I am getting Load Package Failed.

So, what is the wrong?

Please help..

Thanks in advance.

With regards,
Prakash.



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.