Not sure, but it could be "simply" a scoping error. Your syntax implies
that itr_amrs is an instance variable of gnv_app. If so, you should try
this in the DW constructor event:
li_return = dw_1.of_SetTransObject(gnv_app.itr_amrs)
If that doesn't work...
I notice you create itr_amrs, but register the name "AMRS" with the itr_atm
transaction object. Double check that.
If that doesn't work...
I haven't used the transaction object registration service, but it looks
like to do so, you need something like this in the DW constructor event:
n_tr ltr_amrs // local reference
if (gnv_app.inv_trregistration.of_GetByName("AMRS", ltr_amrs) < 0) then
MessageBox("blahblah", "Could not retrieve transaction object AMRS")
return
end if
li_return = dw_1.of_SetTransObject(ltr_amrs)
if (li_return <> 1) then
blahblahblah...
return
end if
--dang
-----Original Message-----
From: Jill M. Claus [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 03, 1999 11:40
To: [EMAIL PROTECTED]
Subject: PFCSIG: Connecting to Two Databases
I am using PowerBuilder 6.5 with Syabase 11 on an NT workstation.
I would like to make an application connect to two different databases. I
put the following script in the pfc_open event of the application manager
object:
// enable transaction registration
gnv_app.of_SetTrRegistration(TRUE)
// register SQLCA
gnv_app.inv_trregistration.of_Register(SQLCA)
// connect to and register ABRN_MRS database
itr_amrs = CREATE n_tr
il_return = SQLCA.of_CopyTo(itr_amrs)
itr_amrs.Database = "ABRN_MRS"
itr_amrs.ServerName = "MTPLZAFINQ3"
ll_return = itr_amrs.of_Connect()
If ll_return <> 0 then
MessageBox("Connection Error", "Unable to connect to ABRN_MRS
database.")
End if
gnv_app.inv_trregistration.of_Register(itr_amrs)
itr_atm.of_SetName("AMRS")
------------------------------------------------
The above code isn't producing any errors, so I think it is working.
My question is.... When I open a datawindow, how do I make it use the
ABRN_MRS database?
Instead of saying ...
li_return = dw_1.of_SetTransObject(SQLCA)
I tried...
li_return = dw_1.of_SetTransObject(itr_amrs)
and
li_return = dw_1.of_SetTransObject(AMRS)
In both cases, I got an message saying it doesn't recognize the variable.
So I tried making the n_tr variables global. But then I got an error saying
that it couldn't assign dw_1 to the type u_dw.
Does anyone know what am I doing wrong?
Any help would be greatly appreciated,
Thanks, Jill
> [EMAIL PROTECTED] HOSTED BY IIGG, INC. FOR HELP WITH LIST SERVE COMMANDS,
ADDRESS
> A MESSAGE TO [EMAIL PROTECTED] WITH THE FOLLOWING MESSAGE: help pfcsig
> SEND ALL OTHER INQUIRES TO [EMAIL PROTECTED]
> [EMAIL PROTECTED] HOSTED BY IIGG, INC. FOR HELP WITH LIST SERVE COMMANDS, ADDRESS
> A MESSAGE TO [EMAIL PROTECTED] WITH THE FOLLOWING MESSAGE: help pfcsig
> SEND ALL OTHER INQUIRES TO [EMAIL PROTECTED]