Show/Hide Toolbars

Xs2Ado Help

Navigation: Examples > Server

Server 5: Relation Window

Scroll Prev Top Next More

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

 

CONSTRUCTOR() 
   // 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( "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()
END CLASS

 

The result is used on a Window