1. radha rani
  2. PowerBuilder
  3. Thursday, 12 April 2018 16:32 PM UTC

Hi Everyone,

 

I have created a window in which inserted a datawindow and in Datawindow i have added text ,texboxes.

But when I am running the application window is showing blank datawindow.

I have used the below code :

long l1_rows
 
dw_1.setTrans(sqlca)
l1_rows=dw_1.retrieve()
if l1_rows < 1 then
dw_1.insertrow( 0)
end if
 
windowstate = maximized!
 
 
PS: How can i attach image in this Q/A so that i can project my question in a more correct manner.

 

Marco Meoni Accepted Answer Pending Moderation
  1. Thursday, 12 April 2018 16:50 PM UTC
  2. PowerBuilder
  3. # 1

Hi Radha,

  • Did you properly connect to the database?

SQLCA.DBMS = "ODBC"
SQLCA.DBParm = "ConnectString='DSN=PB Demo DB V2017R2;UID=dba;PWD=sql'"
Connect using sqlca; // sqlca.sqlcode must returns 0, which means connection established

  • Did you assign the dataobject to the datawindow control at design time? If not, you are missing

dw_1.DataObject = ‘d_yourdataobject’

  • Instead of SetTrans, use the SetTransObject method to specify the transaction object. It is more efficient 
  • Last but not lest, you must have columns in you dataobject. “text” and ”textboxes” are not enough when you execute InsertRow() 

Best,

Marco

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Friday, 13 April 2018 02:06 AM UTC
  2. PowerBuilder
  3. # 2

First you should use SetTransObject instead of SetTrans.

If it works when run from the IDE but not from an exe, the likely cause is that the DataWindow object was not included in the exe by the compiler. You need to create a .PBR file listing the DataWindow objects that are assigned in code.

A .PBR file is a text file that lists image files and DataWindow objects like this:

libraryname.pbl(d_mydatawindow)

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.