Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use non VFP events
Message
De
26/06/2002 19:54:57
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00671914
Message ID:
00672736
Vues:
10
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
Fil
Voir

Click here to load this message in the networking platform