on 09-23-2014 3:33 PM
I have created a transaction userobject as given below
global type uo_customerfrom transaction end type global uo_customer uo_customer type prototypes FUNCTION long f_InsertCustomer ( REF int al_id,REF string as_customer) RPCFUNC ALIAS FOR 'spInsertCustomer' end prototypes type variables end variables on uo_customer.create call super::create TriggerEvent( this, "constructor" ) end on on uo_customer.destroy TriggerEvent( this, "destructor" ) call super::destroy end on
PowerBuilder script for insert record by calling function uo_customer luo_customer luo_customer= create uo_customer luo_customer.f_InsertCustomer (li_id,ls_name) // Here error is coming Transaction not connected. Pls help
For the sake of those trying to read this, here's the formatted version of the code:
global type uo_customerfrom transaction
end type
global uo_customer uo_customer
type prototypes
FUNCTION long f_InsertCustomer ( REF int al_id,REF string as_customer) RPCFUNC ALIAS FOR 'spInsertCustomer'
end prototypes
type variables
end variables
on uo_customer.create
call super::create
TriggerEvent( this, "constructor" )
end on
on uo_customer.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on
o_customer luo_customer
luo_customer= create uo_customer
luo_customer.f_InsertCustomer (li_id,ls_name) // Here error is coming Transaction not connected.
And the question would be: Where are you actually connecting that custom transaction class to the database?
You might go into the application properties and make the class that SQLCA is created from uo_customer. Then the code (after SQLCA is connected to the database) would look like:
SQLCA.f_insertCustomer ((li_id,ls_name)
Otherwise, you need to connect lou_customer to the database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You inherited from the transaction class. You would do it the same way you would connect SQLCA. Set the DBMS parm, user or login name, password, etc. Then issue a CONNECT statement using the custom class.
lou_customer.SQLCA = ???
lou_customer.LogPass = ???
luo_customer.LogID = ???
luo_customer.ServerName = ????
CONNECT USING luo_customer
IF lou_customer.SQLCode <> 0 THEN etc, etc, etc,
It looks like you did not connect to the database using the transaction object you've created. You need to connect the same way as you would using SQLCA.
If you still want to use sqlca using the transaction object you've created, then you need to modify the global type declaration of sqlca in your application object. Try these steps:
1. Edit Source your application object.
2. Look for this line: global transaction sqlca
3. Replace the 'transaction' with uo_customer, so it would look like global uo_customer sqlca
4. Save changes
5. Test again.
HTH,
Neil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.