Information générale
Catégorie:
COM/DCOM et OLE Automation
Antonio,
i have run its program in server where SQL was installed
codes below:
***********************************************************
public oEvents,dtspkg,pbCancel
lcrep='Bank_cb' && or any own package
dtspkg=createobject('dts.package')
if type("dtsPkg")<>"O" or isnull(dtspkg)
messagebox("can't create dts.package!",16,"** import tables of REPCB **")
return .f.
endif
* On Error lcdtsError=.t.
dtspkg.failonerror = .t.
lccom="dtsPkgName=dtsPkg.LoadFromSQLServer('TBNTS40BNT03','RPADMIN','RPADMIN',,,,,'"+ lcrep+"') " && need use own server , owner, password
&lccom
if dtspkg.failpackageonlogfailure
messagebox("load DTS pasckage "+ lcrep+" finished with errors. !",16,"** import tables of REPCB **")
endif
oEvents = CREATEOBJECT("DTSEvents")
if EVENTHANDLER(dtspkg, oEvents )
oRS=dtspkg.execute && error here
endif
return
DEFINE CLASS DTSEvents AS session
IMPLEMENTS PackageEvents IN "dts.package"
procedure PackageEvents_OnStart(EventSource As string @) AS string
? "oPackage_OnStart Fired"
procedure PackageEvents_OnFinish(EventSource As string @) AS string
? "oPackage_OnFinish Fired"
procedure PackageEvents_OnError( EventSource As string @, ;
ErrorCode As Number @, ;
Source As string @, ;
Description As string @, ;
HelpFile As string @, ;
HelpContext As Number @, ;
IDofInterfaceWithError As string @,;
pbCancel As LOGICAL @) AS string
* wait window "oPackage_OnError" nowait
? "oPackage_OnError"
procedure PackageEvents_OnProgress( EventSource As string @, ;
ProgressDescription As string @, ;
PercentComplete As Number @, ;
ProgressCountLow As Number @, ;
ProgressCountHigh As Number @) AS string
* wait window "oPackage_OnProgress Fired" nowait
? "oPackage_OnProgress Fired"
*!* procedure PackageEvents_OnQueryCancel(EventSource As string @, ;
*!* pbCancel As LOGICAL @) AS string
procedure PackageEvents_OnQueryCancel(EventSource As string @, ;
pbCancel As LOGICAL @)
* wait window "oPackage_OnQueryCancel Fired" nowait
* ? "oPackage_OnQueryCancel Fired"
a=1 && ERROR here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
? str(a)
*!* b=2
*!* ? str(b)
*!* c=3
*!* ? str(c)
enddefine
****************************************************
>Andrey:
>
>In fact, I have never used EventHandler with a dts Package. It seems to be a permissions or an installation problem. Are you running your code in the server itself or in another workstation ?.
>
>If you post the code that give you the error, I can try it here ...
>
>>Antonio,
>>thanks for your response
>>i see, but i get new error EXCEPTION_ACCESS_VIOLATION
>>when DTS events fire
>>is it new for you?
>>
>>
>>>Andrey
>>>
>>>If you are using VFP 7, you can use the EventHandler() function.
>>>
>>>In VFP 6, you have to use the VFPCom .dll
>>>
>>>
>>>>Hi,
>>>>can i use non VFP events in VFP anyhow?
>>>>for sample MS SQL DTS Packages events
>>>>
>>>>Thanks
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement