Home > Software engineering >  Use ADOX to create the database error, please everyone a great god see
Use ADOX to create the database error, please everyone a great god see

Time:10-06

I created a dialog based MFC procedures, and successfully imported dynamic link library and the initialization function, in OnInitDialog () in the database is created automatically, "invalid pointer" problems, (when I use the button to manually create a database, will not appear this kind of problem) code is as follows,
Cstrings DBName="Provider=Microsoft. JET. The OLEDB. 4.0. Data source=";
Cstrings STR="e: \ \ hahaha. MDB".
DBName=DBName + STR;
If (PathFileExists (STR))
{
Existing AfxMessageBox (" database ");
return TRUE;
}
Try
{
M_pCatalog=NULL;
M_pCatalog. CreateInstance (__uuidof (ADOX: : the Catalog));
M_pCatalog - & gt; Create (_bstr_t (LPCTSTR DBName));
}
The catch (_com_error & amp; E)
{
AfxMessageBox (e.E rrorMessage ());
return FALSE;
}

CodePudding user response:

M_pCatalog. CreateInstance (__uuidof (ADOX: : the Catalog));
Here is to create a pointer to succeed

CodePudding user response:

Might be a permissions problem,
  • Related