Hyderabad Jobs Book Website FREE PowerBuilder Training I Love Hyderabad Hyderabad Colleges
Home Business Emails Hyderabad Classifieds Contact Us
7 Wonders of Hyderabad Web Hosting Yellow Pages Our Network

 
Webpowerbuilder.hyderabad-colleges.com

Mastering PowerBuilder

HomePrevious Lesson: Programming Jaguar CTS Component
Next Lesson: Method to Retrieve Data

Activate/Deactivate Events

What we want to do in the Activate event is, connect to the database and set the transaction object to the DataStore.
Object: n_product_master
Event: activate
GetContextService( "TransactionServer", its_Jaguar )
GetContextService( "ErrorLogging", iel_Jaguar )
SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "UseContextObject='Yes',CacheName='productCache'"
CONNECT;
IF SQLCA.SQLCODE <> 0 THEN iel_Jaguar.log("Cannot Connect")
ids_data = CREATE datastore
ids_data.dataobject = "d_products_maint"
ids_data.SetTransObject(SQLCA)

Please note the CacheName option in the DBParm property. We are asking the Jaguar to use connection by cache name instead of matching the connection by server name, user name and password. If there are any problems, then we are logging them using the ErrorLogging object.
Object: n_product_master
Event: DeActivate
DISCONNECT;

In the Deactive event, we are simply disconnecting from the database; we don't want to keep the connection open and idle for long time.
HomePrevious Lesson: Programming Jaguar CTS Component
Next Lesson: Method to Retrieve Data

Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com