Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: ERROR MESSAGE() Function with ODBC Connection Causes Error


View products that this article applies to.

This article was previously published under Q187746

↑ Back to the top


Symptoms

Placing the ERROR MESSAGE() function before or after an SQLCONN() command causes Visual FoxPro 5.0x to perform an illegal operation under Windows NT 4.0. Under Windows 95, the following error appears:
This application has performed and illegal operation and will be shutdown.
Clicking the Details button reveals the following message:
VFP caused an invalid page fault in module <unknown> at <memory address>.

↑ Back to the top


Cause

The behavior only occurs when the ERROR MESSAGE text is a null string. If any error occurs before SQLConnect() is called, ERROR MESSAGE() reports the text of the last error, and the code does not cause the memory protection fault.

↑ Back to the top


Status

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

↑ Back to the top


More information

Steps to Reproduce Behavior

Create a program that contains the following code and run the program:

Note You will need to change User UID=<username> and PWD=<strong password> to the correct values before you run this code. Make sure that UID has the appropriate permissions to perform this operation on the database.
   #DEFINE connectionstring ;
      'driver={sql server};server=sql;database=pubs;uid=<username>;pwd=<strong password>'
   connhand = SQLSTRINGCONNECT(connectionstring)
   = SQLDISCONN(connhand)
   ERROR MESSAGE()   && causes error in VFP 5.0x
					
After the code runs, the error described in the SYMPTOMS section appears.

↑ Back to the top


Keywords: KB187746, kbpending, kbbug

↑ Back to the top

Article Info
Article ID : 187746
Revision : 4
Created on : 3/3/2005
Published on : 3/3/2005
Exists online : False
Views : 468