示例
String ls_cust_code,ls_customer_name,ls_address
long ll_row,ll_row_count
datastore lds_dstastore
lds_datastore = CREATE datastore
lds_datastore.dataobject = "dw_customers" //dw_customers為已經存在的數據視窗對象
lds_datastore.settransobject(sqlca)
lds_datastore.retrieve()
ll_row_count = lds_datastore.rowcount()
FOR ll_row = 1 to ll_row_count
ls_cust_code = lds_datastore.getitemstring(ll_row,"cust_id")
ls_customer_name = lds_datastore.getitemstring(ll_row,"cust_name")
ls_address = lds_datastore.getitemstring(ll_row,"cust_address")
NEXT
DESTROY lds_datastore
一個調用datastore顯示數據的示例:
datastore ds_demo //聲明
ds_demo= create datastore //實例化
ds_demo.dataobject = "d_demo" // d_demo為已存在數據對象
ds_demo.settransobject(sqlca)
ds_demo.retrieve()
dw_1.dataobject = ds_demo.dataobject // 為可見數據視窗dw_1傳遞數據
ds_demo.sharedata(dw_1) //