CDaoWorkspace::RepairDatabase

Call this member function if you need to attempt to repair a corrupted database that accesses the Microsoft Jet database engine.

static void PASCAL RepairDatabase( 
   LPCTSTR lpszName  
);

Parameters

  • lpszName
    The path and filename for an existing Microsoft Jet engine database file. If you omit the path, only the current directory is searched. If your system supports the uniform naming convention (UNC), you can also specify a network path, such as: "\\\\MYSERVER\\MYSHARE\\MYDIR\\MYDB.MDB". (Double backslashes are required in the path string because "\" is the C++ escape character.)

Remarks

You must close the database specified by lpszName before you repair it. In a multiuser environment, other users cannot have lpszName open while you are repairing it. If lpszName is not closed or is not available for exclusive use, an error occurs.

This member function attempts to repair a database that was marked as possibly corrupt by an incomplete write operation. This can occur if an application using the Microsoft Jet database engine is closed unexpectedly because of a power outage or computer hardware problem. If you complete the operation and call the Close member function or you quit the application in a usual way, the database will not be marked as possibly corrupt.

참고

After repairing a database, it is also a good idea to compact it using the CompactDatabase member function to defragment the file and to recover disk space.

For more information about repairing databases, see the topic "RepairDatabase Method" in DAO Help.

Requirements

Header: afxdao.h

See Also

Reference

CDaoWorkspace Class

Hierarchy Chart

Other Resources

CDaoWorkspace Members