Server 5: Relation Window

<< Click to Display Table of Contents >>

Navigation:  Examples > Server >

Server 5: Relation Window

Previous pageReturn to chapter overviewNext page

This sample shows the results of using 2 related servers on a DataWindow

It shows a subclass of AdoRelationServer that has an embedded child server

 

GLOBAL goConn AS AdoConnection

CLASS PubServer INHERIT AdoRelationServer

 EXPORT oTitles AS AdoRelationServer

 

METHOD Init() CLASS PubServer

 // Create a connection with the MsDataShape provider to the Pubs database

 IF goCOnn == NULL_OBJECT

         goConn   := AdoConnection{}

         goConn:Open ( "Provider=SQLOLEDB;" + ;

                 "Server=(local);uid=sa;pwd=;database=pubs",NIL,NIL,NIL)

         // Set the, so Xs2Ado can use the connection to get information

         // about the last errors that occurred

         AdoSetConnection(goConn)

 ENDIF

 // Create two related servers

 SUPER:init ( "select * from publishers",goConn,adOpenStatic,adLockReadonly,NIL)

 SELF:oTitles := AdoRelationServer{"select * from titles",;

         goConn,adOpenStatic,adLockReadonly,NIL}

 SELF:SetRelation(SELF:oTitles, #Pub_id)

 SELF:oTitles:GoTop()

 

The result is used on a Window