Pages

Thursday, February 16, 2012

Powerbuilder Datastore


Basicly, DataStore is a nonvisual DataWindow control.

DataStores act just like DataWindow controls except that many of the visual properties associated with DataWindow controls do not apply to DataStores. However, because you can print DataStores, PowerBuilder provides some events and functions for DataStores that pertain to the visual presentation of the data.

Why and when DataStore is used?
We use the datastore, if we want to work with the data in datawindow, but only at the background. User doesn't need to see the data itself. Yes, indeed, we can use datawindow also to do that, with disable in the visible property. But, it's mean you need to insert the database control on your application, and also means that the control will always in the memory as long as the application is running. With the datastore, you just need to create the control when is needed, and can be destroyed when no longer needed.

Creating Datastore
First of all, you need the datawindow object. Create the datawindow object, and named as "d_mydatawindow".

1:  // declare the variable  
2:  DataStore dsMyDataStore  
3:    
4:  // create the control  
5:  dsMyDataStore = Create DataStore  
6:    
7:  // assign the datawindow object to datastore  
8:  dsMyDataStore.DataObject = "d_mydatawindow"  
9:    
10:  // bind the data  
11:  dsMyDataStore.SetTransObject(SQLCA)  
12:  dsMyDataStore.Retrieve()  
13:    
14:  // script to process the datastore control, same treatment like datawindow control except the visual functions or properties.  
15:  .....  
16:    
17:  // destroy datastore  
18:  DESTROY myDataStore  

3 comments :

  1. Hi, Nice posts on PB. And thanks for putting a link to my blog here. I will add your blog to mine as well. Hope we can cooperate on some future posts.

    One suggestion about color - it's kind of hard to read green text (code) on black background. You may want to consider another theme or changing color(s). Keep up the good work!

    Best wishes,

    Sam

    ReplyDelete
  2. Hi Sam

    Thank you for visiting my blog and also put my link into your.

    Also thanks for color suggestion, I already changed the code color for newest posts.

    BR
    Sutisna

    ReplyDelete