Problem opening paradox files with MFC DAO 
Author Message
 Problem opening paradox files with MFC DAO

I have been able to open paradox database files using the MFC DAO.  I have
been able to open the other types of databases (access, foxpro, dBase, etc)
without a problem.  Has anybody else had a problem opening paradox files?
If so, how did you fix the problem?  I'm using the following function to
open paradox files:

LPCSTR PARADOX3X =      "Paradox 3.x";
LPCSTR PARADOX4X =      "Paradox 4.x";
LPCSTR PARADOX5X =      "Paradox 5.x";

LPCSTR aParadoxConnect[] =
{
        PARADOX3X,
        PARADOX4X,
        PARADOX5X,

Quote:
};

BOOL Open_Paradox(LPCSTR szFileName, CDaoDatabase& db)
{
        // the file name is what is to be opened
        // the driver for paradox opens an entire directory.  so we
        // need to get the path and open the directory
        CPath path(szFileName);
        CString strDir(GetPath(path));

        for ( int i = 0; i < sizeof(aParadoxConnect)/sizeof(LPCSTR); i ++)
        {
                TRY
                {
                        db.Open(strDir, FALSE, FALSE, aParadoxConnect[i]);                      
                }

                CDaoException DaoErr;
                CATCH(CDaoException, DaoErr)
                {
                        // for now assume all all exception are
                        // because we can't open the database
                        DisplayDaoException(DaoErr, "Paradox", TRUE);
                        continue;
                }
                END_CATCH

                if (db.GetTableDefCount())
                {
                        // if we can read the table definition we are connected
                        return TRUE;
                }
                else
                {
                        // no table def so we have the wrong connect string
                        continue;
                }
        }

        return FALSE;

Quote:
}

-----------------------




Tue, 06 Jul 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Accessing Paradox 5.0 (and below) tables using MFC/DAO

2. Exception trying to open file using mfc dao

3. VB to MFC Paradox DSN-less porting problem

4. Problem creating Paradox datafile using MFC

5. Problem with mfc File/New and Open functionality

6. problem with mfc File/New, Open functionality

7. problem with mfc File/New, Open functionality

8. Opening databases using MFC/DAO

9. Paradox and DAO

10. DAO and PARADOX

11. Paradox and DAO

12. Paradox and DAO

 

 
Powered by phpBB® Forum Software