Question:
I am 90 percent done building a product catalog using PB 5.0.2 and SQL Anywhere 5.5.
I just added a feature that uses a datastore to retrieve pricing information and update an onscreen datawindow. Here’s an excerpt:
datastore lds_datastore … lds_datastore = CREATE datastore lds_datastore.DataObject = “d_price” // Assign SQL here lds_datastore.SetTransObject(SQLCA) … lds_datastore.Retrieve (ls_item_nbr) // Fetch a price ls_price = lds_datastore.GetItemDecimal(1,1) dw_results_window.SetItem(ll_row,”suggest_retail_price”,ls_price) … DESTROY lds_datastoreThis works great on my development box, but when I deploy I get the error “Application terminated. Error: Datawindow column type doesn’t match Getitem type.”
I can simulate this in development by changing the DataObject to d_prices
, so it seems to me that PB can’t find the d_prices
datawindow in the runtime library on the deployed box.
I optimized and rebuilt the runtime library and the executable, but still no luck…
Answer:
I think your diagnosis is correct: PowerBuilder cannotfind the Datawindow object at runtime, so it gives you the error you describe.
This is normally caused by PowerBuilder not including the Datawindowobject in your executable. When PowerBuilder builds your executable, it tries to beclever and checks recursively the PBLs for all the objects that arereferenced by the application. Because your datawindow is referenced by astring d_price
, PowerBuilder does not realize there is a reference tothat object and thus does not include it in your executable.
To solve this problem you need to create a PBR (PowerBuilderResource) file, which enables you to tell PowerBuilder to include anobject it wouldn’t normally include. These can include bitmaps, icons and datawindows.
Create a file and add the following entry:
my_pbl.pbl(d_price)where
my_pbl
is replaced with the library name where d_price
is located.Then add the PBR file to the .exe resource file in the project painterand rebuild your executable.