Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's wrong with creating datawindow?

Status
Not open for further replies.

Negator

Programmer
Oct 4, 2003
33
RU
Hello all PowerBuilder wizards!

I use such code to create datawindow:

datawindow NewDw
long Code

NewDw = create datawindow
NewDw.DataObject = 'main_datawindow'
Code = NewDw.SetTransObject(SQLCA)
MessageBox('code', string(code))


It returns -1, so SetTransObject fails. However, I tried to create a datawindow control manually at design-time and use such code:

//datawindow NewDw
long Code

//NewDw = create datawindow
NewDw.DataObject = 'main_datawindow'
Code = NewDw.SetTransObject(SQLCA)
MessageBox('code', string(code))

As you guess it works! What is my mistake?
Thank you!!!
 
Is the transaction object connected to the database at run time?
 
1. In this case you should use Datasore instead of Datawindow:

Code:
datastore NewDw
long Code

NewDw = create datastore
NewDw.DataObject = 'dw_main'
Code = NewDw.SetTransObject(SQLCA)
MessageBox('code', string(code))

2. if you want to use Datawindow you can add this line:
Code:
/*CurrentWindow.&*/
OpenUserObject(NewDw,1,1)

and it looks like:

Code:
datawindow NewDw
long Code

NewDw = create datawindow
/*CurrentWindow.&*/
OpenUserObject( NewDw, 1,1)
NewDw.DataObject = 'main_datawindow'
Code = NewDw.SetTransObject(SQLCA)
MessageBox('code', string(code))



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top