Specifying the database connection and retrieving data

Specifying connection information

SetTrans You provide connection information for the server component with the SetTrans method. For an ODBC connection to SQL Anywhere, you specify all the connection information in the dbParm argument. In EAServer, you must also set up a connection cache for the component, described in “Creating a connection cache on EAServer 5.x”.

Define the data source on the server machine. It must be a system DSN on EAServer if the component is running as a service. This statement connects to the EAS Demo DB sample database:

dwGen.SetTrans("ODBC","ConnectString='DSN=EAS Demo DB V125;UID=dba;PWD=sql'",		"", "", "", "", "");

If you use the XML Web DataWindow, call the SetPageSize method to limit the number of rows per page:

dwGen.SetPageSize(2);

NoteUsing Adaptive Server Enterprise PowerBuilder and EAServer use slightly different versions of the CT-Lib software to connect to Adaptive Server Enterprise via Open Client. In the PowerBuilder development environment, you use the SYC native database interface to connect to the database, but you must use SYJ as the first argument to SetTrans to connect to ASE in EAServer.

Retrieving data

Retrieve To tell the server component to retrieve data when the DataWindow object does not have retrieval arguments, you call the Retrieve method:

	retVal = dwGen.Retrieve();

Specifying retrieval arguments

RetrieveEx If the DataWindow object expects retrieval arguments, call RetrieveEx:

dwGen.RetrieveEx("60000");

Typically, the retrieval arguments are not constants. They are page parameters passed to the page from another page where you filled in a form or clicked a hyperlink. If the DataWindow expects more than one retrieval argument, the arguments must be passed in a single string. Separate arguments in the string by newline characters (\n). Individual values cannot contain newline characters as part of the value. Separate array values by tab characters (\t).

Getting the retrieval argument from another page works the first time you load the page. The retrieval arguments have to be page parameters each time the page is reloaded. To specify page parameters for the reloaded page, you use the SetSelfLink method.