BUG: SIMBA.DLL ODBC Driver Resets FoxPro Default Directory

Last reviewed: June 27, 1995
Article ID: Q115728
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6
  • Microsoft FoxPro Connectivity Kit, versions 2.5, 2.5a, 2.5b, 2.6
  • ODBC Desktop Driver SIMBA.DLL, version 1.01.1928

SYMPTOMS

After SIMBA.DLL has been used to interact with either a .CSV or .TXT file, the FoxPro default directory is set to the location of the data file.

RESOLUTION

To work around this problem, do the following:

  1. Use SYS(2003) to store the current directory to a memory variable:

          curdir = SYS(2003)
    

  2. Execute the ODBC code that uses the SIMBA.DLL Text driver.

  3. Issue a SET DEFAULT TO statement to switch back to the original directory:

          SET DEFAULT TO &curdir
    

STATUS

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

MORE INFORMATION

SIMBA.DLL, the single-tier ODBC driver used to access data from text files, processes information from any of four different file formats: CSV (Comma- Separated Value) Delimited, Tab Delimited, Custom Delimited, or Fixed Length. Regardless of the file format chosen for the Data Source in the ODBC Driver Manager Setup dialog box, a call to the driver results in a switch of FoxPro's default directory to the directory in which the data source file resides.

Steps to Reproduce Problem

  1. In Control Panel, open the ODBC Driver Manager and set up the "Text Files (*.txt; *.csv)" driver with a Data Source name of "Simba Test" and a directory name of "c:\<foxpro_directory>\mytext".

  2. Copy some text files (TEXT1.CSV, TEXT2.CSV, and so on) to C:\<foxpro_directory>\MYTEXT. The contents of the files do not matter.

  3. Make sure FPSQL.FLL is in the FoxPro program directory, c:\<foxpro_directory>.

  4. Start FoxPro and set the default FoxPro directory:

          SET DEFAULT TO c:\<foxpro_directory>
    

  5. In the Command window, type:

          MODIFY COMMAND simba
    

  6. Type the following lines of code:

          * Program: SIMBA.PRG
    

          * Initialize
    

          SET LIBRARY TO SYS(2004)+"FPSQL.FLL"
          PUBLIC errval, errmsg, handle
          errval=0
          errmsg=""
          sourcename="Simba Test"
          user=""
          passwd=""
    

          * Connect
    

          handle = DBCONNECT(sourcename,user,passwd)
          IF handle > 0
    
             WAIT WINDOW "Successfully Connected" NOWAIT
          ELSE
             error = DBERROR(0,@errmsg,@errval)
             WAIT WINDOW STR(error)+" "+STR(errval)+" "+errmsg
          ENDIF
    
          * View tables (text files) out there (TEXT1.CSV, TEXT2.CSV, etc.)
    
          err=DBTABLES(handle,"'TABLE'")
          DO errhand WITH err,"DBTABLES()"
          IF err>0
             BROWSE
          ENDIF
    
          * Disconnect
    
          err=DBDISCONN(handle)
          DO errhand WITH err,"DBDisconn()"
          SET LIBRARY TO
          CLOSE ALL
    
          * Error handler
    
          PROCEDURE errhand
          PARAMETERS err,command
          IF err > 0
             WAIT WINDOW ALLTRIM(UPPER(command))+" Completed Successfully" ;
                NOWAIT
          ELSE
             WAIT WINDOW UPPER(COMMAND)+" NOT Completed"
             error=DBERROR(handle,@errmsg,@errval)
             WAIT WINDOW STR(error)+" "+STR(errval)+" "+errmsg
          ENDIF
          RETURN
    
    

  7. Press CTRL+W to close and save the program.

  8. In the Command window, type:

          DO simba.prg
    

    The program makes a connection to the data source and displays a Browse window of tables (text files TEXT1.CSV, TEXT2.CSV, and so on).

  9. Press CTRL+W to close the Browse window.

  10. In the Command window, type

          ? SYS(2003)
    

    and look at the line printed in the desktop. The default directory, which is returned by SYS(2003), has changed from "c:\<foxpro_directory>" to "c:\<foxpro_directory>\mytext".

REFERENCES

FoxPro Connectivity Kit "User's Guide," versions 2.5 and 2.6


Additional reference words: FoxWin 2.00 2.50 2.50a 2.50b 2.60 buglist2.00
buglist2.50 buglist2.50a buglist2.50b buglist2.60
KBCategory: kbenv kbprg kbbuglist
KBSubcategory: FxtoolCk


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.