帮我看数据库的错误
BOOL CShoreApp::InitInstance()
{
CString sPath;
GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
sPath.ReleaseBuffer ();
int nPos;
nPos=sPath.ReverseFind ('\\');
sPath=sPath.Left (nPos);
nPos=sPath.ReverseFind('\\');
sPath=sPath.Left (nPos);
CString lpszFile = sPath + "\\shore.mdb";
char* szDesc;
int mlen;
szDesc=new char[256];
sprintf(szDesc,"DSN=%s? DESCRIPTION=TOC support source? DBQ=%s? FIL=MicrosoftAccess? DEFAULTDIR=%s?? ","shore",lpszFile,sPath);
mlen = strlen(szDesc);
for (int i=0; i<mlen; i++)
{
if (szDesc[i] == '?')
szDesc[i] = '\0';
}
if (FALSE == SQLConfigDataSource(NULL,ODBC_ADD_DSN,"Microsoft Access Driver (*.mdb)\0",(LPCSTR)szDesc))
AfxMessageBox("SQLConfigDataSource Failed");
try
{
CString strConnect;
strConnect.Format("DSN=shore;");
if(!m_DB.OpenEx(strConnect,CDatabase::useCursorLib))
{
AfxMessageBox("Unable to Connect to the Specified Data Source");
return FALSE ;
}
}
catch(CDBException *pE)
{
pE->ReportError();
pE->Delete();
return FALSE;
}
编译错误:
e:\shore\shore.h(42) : error C2146: syntax error : missing ';' before identifier 'm_DB'
e:\shore\shore.h(42) : error C2501: 'CDatabase' : missing storage-class or type specifiers
e:\shore\shore.h(42) : error C2501: 'm_DB' : missing storage-class or type specifiers
E:\shore\shore.cpp(78) : error C2065: 'm_DB' : undeclared identifier
E:\shore\shore.cpp(78) : error C2228: left of '.OpenEx' must have class/struct/union type
E:\shore\shore.cpp(78) : error C2653: 'CDatabase' : is not a class or namespace name
E:\shore\shore.cpp(78) : error C2065: 'useCursorLib' : undeclared identifier
E:\shore\shore.cpp(84) : error C2061: syntax error : identifier 'CDBException'
E:\shore\shore.cpp(84) : error C2310: catch handlers must specify one type
E:\shore\shore.cpp(86) : error C2065: 'pE' : undeclared identifier
E:\shore\shore.cpp(86) : error C2227: left of '->ReportError' must point to class/struct/union
E:\shore\shore.cpp(87) : error C2227: left of '->Delete' must point to class/struct/union
E:\shore\shore.cpp(92) : error C2317: 'try' block starting on line '75' has no catch handlers
Error executing cl.exe.
shore.exe - 13 error(s), 0 warning(s)