Microsoft KB Archive/169500

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:48, 20 July 2020 by X010 (talk | contribs) (Text replacement - ">" to ">")
Knowledge Base


How To Call Driver Specific Functions in a Remote View

Article ID: 169500

Article Last Modified on 6/29/2004



APPLIES TO

  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 5.0 Standard Edition
  • Microsoft Visual FoxPro 5.0a



This article was previously published under Q169500

SUMMARY

Calling driver-specific functions in a remote view requires special syntax when used in the filter expression of a remote view.

MORE INFORMATION

When calling any driver-specific functions in the filter of a remote view, you must use the following syntax:

   {fn FUNCTIONNAME()}
                

If the correct syntax is not used, then the following error is produced when returning from the expression builder and the expression is not returned:

Invalid Subscript Reference

NOTE: In Microsoft Visual FoxPro 5.0(a), driver-specific functions are included in the Functions drop-downs and the correct syntax is pasted into the Expression edit box (for example, '{fn FUNCTIONNAME()}').

In Microsoft Visual FoxPro 3.0b, the driver-specific functions return the incorrect syntax. The Expression Builder omits "{fn }" from the driver specific-functions.

Example

This example requires access to the Microsoft SQL Server sample database called "Pubs."

Modify the following code to point to your Microsoft SQL Server, with appropriate user ID (UID) and password (PWD) specified:

   CREATE DATABASE TESTSQL
   CREATE CONNECTION TESTCONN CONNSTRING ;
      "Driver=SQL Server;Server=MySQLServer;UID=UserName;PWD=StrongPassword;DATABASE=PUBS"
   CREATE SQL VIEW TESTVIEW REMOTE CONNECTION TESTCONN
                

Note The user, Username, must have permissions to perform these operations on the database.

Running the above code will do the following:

  • Create the database "TestSQL."
  • Create a connection "TestConn."
  • Create a View using the connection TestConn and display the Remote View Designer.

After running the above program perform the following steps:

  1. Add the Authors table and close the Add Table dialog box.
  2. On the Fields tab, include several fields from the table.
  3. Select the Filter tab.
  4. Drop down the list under Fields and select <Expression>.
  5. In the Expression edit box enter the following: {fn SUBSTRING(AUTHORS.PHONE,1,1)}
  6. Click Verify and ensure that the expression is valid.
  7. Click OK.
  8. In the Criteria column, select =.
  9. In the Example column, type "9" (with the quotes).
  10. Run the view.


One record will be returned from the Authors table in the Pubs database.


Keywords: kbhowto kbinterop kbautomation KB169500