Introduction to PowerBuilder

HomePrevious Lesson: Allowing the User to Cancel the Login
Next Lesson: Database Independence

Linking DataWindow to the Database

What we did till now was to make a connection to the database from the PowerBuilder application. Before database manipulation, there is one more step we need to complete, i.e., linking DataWindow to the database? You may say, "We already connected to the database, now why should we link a DataWindow to the database?". It's a good question.

PowerBuilder is designed to work in heterogeneous database environment. That means two things for us. Firstly, you can connect a PowerBuilder application to any database. Secondly, you can have different database connections open at the same time in the same application. If database connections from multiple databases are open, which database should a particular DataWindow use? Hmm!!!.

The solution for this problem is, linking a DataWindow to a database by calling either SetTrans() or SetTransObject().

It might seem strange, since we've already defined the data source for the DataWindow object. There are two main benefits to this:
HomePrevious Lesson: Allowing the User to Cancel the Login
Next Lesson: Database Independence