Application Note - Using Stored Procedure Data Linksred Procedure Data Links
|
||||||||
Manager Contents User Contents |
||||||||
Introduction Stored procedure data links allow selection list data or field defaults to be loaded from SQL databases located anywhere on your network. This application note demonstrates how the feature may be used. This example will use the pubs database on Microsoft SQL Server. The pubs database is a sample database that can be installed if desired. To verify that your server contains this database, open SQL Server Management Studio and browse the databases on your system. It can be downloaded from Microsoft if it does not exist. Step 1 - Create a Stored Procedure
Notice that "pubs.dbo.authors" is a fully-qualified source specification in the form database.owner.object_name. "au_lname" is the name of the column in the authors table that contains last name information for the authors.
Step 2 - Test the Stored Procedure
Step 3 - Create a Stored Procedure Data Link in CATSWeb In CATSWeb Manager, select Data Links, then add a new Stored Procedure Data Link. Enter or select these values in the fields:
Leave all the parameter entries blank since your stored procedure does not require or accept parameters. NOTE: After you save the data link, CATSWeb will automatically rename it to "[Pubs Authors]" so that it (as a user-defined data link) can be distinguished from common lists or system data links. Step 4 - Bind the Data Link to a Form Field In CATSWeb Manager, select Field Definitions for the category in which you want to add the link. Click a field to redefine for this purpose. On the Form Definition Edit page, select "[Pubs Authors]" from the Bind to List pull-down. Change the caption to "Authors" and edit other values as desired. Step 5 - Mission Accomplished Save the field definition. Scroll down to the sample form that you added the link to. The pull-down list should now display a list of author last names from the Pubs database. Linking to Databases on Other Servers The technique illustrated above can be extended to allow databases that reside on other servers to be linked into CATSWeb. Assume that you wish to link in data from the Pubs database that resides on a server called "MfgServer". The following modifications and additions to the above procedure are required: Stored procedures can now be developed that refer to tables on MfgServer. For example: Notice that "MfgServer.pubs.dbo.authors" is a fully-qualified source specification in the form server.database.owner.object_name. Repeat the steps above to test the procedure, link it in, etc. Note that for this technique to work, the MfgServer must have a user name/password combination that is identical to the user name/password used by CATSWeb for accessing the CATSWeb database. That user name must have Select permission for the tables that will be accessed. If your stored procedure needs to receive parameters from CATSWeb, see this topic for an example and more information. |