´´½¨ACCESSÎļþµ÷ÓÃOLEFUNCTIONʱ²úÉú´íÎó£¬ÔÚÏßÇóÖú
ÎÒÔÚCBÁ·´´½¨ACCESSÎļþ£¬
²ÉÓõÄÏÂÁдúÂë,ÎÒרÃÅÏÈ×ö¸öС³ÌÐò²âÊÔ£¬Ò»ÇÐÕý³£¡£
È»ºóÔÚ¼ÓÔص½1¸öÈí¼þÖУ¬
´«ÈëµÄ±äÁ¿MDB_PathNameÒ²ÊÇÕýÈ·µÄ¡£
µ«ÔÚÖ´ÐÐ
mdb.OleFunction("Create",DataSource);
³ö´í!
Project app.exe raised exception class EAccessViolation with message
'Access violation at address 0055da57 . Read of address 00000800'
C/C++ code:
bool CreateAccess(AnsiString MDB_PathName)
{
/*
´´½¨Ö¸¶¨Ãû³ÆµÄmdbÊý¾Ý¿â£¬³É¹¦·µ»Øtrue
MDB_PathNameΪmdbÎļþËùÔڵķ¾¶ºÍÎļþÃû
ÓÉÓÚҪʹÓÃVariantÐͱäÁ¿£¬Òò´ËÒª#include <ComObj.hpp>
*/
bool seccess = false;
if(FileExists(MDB_PathName))//Èç¹ûMDBÎļþÒÑ´æÔÚ£¬Ôòɾ³ý£¬·ñÔò»á³ö´í
{
if(MessageBox(0, AnsiString(MDB_PathName+"ÒÑ´æÔÚ,È·¶¨É¾³ýÎļþ¼ÌÐø,È¡ÏûÍ˳ö").c_str()
,"ɾ³ýÒÑ´æÔÚÎļþ£¿"
, MB_OKCANCEL + MB_ICONQUESTION + MB_DEFBUTTON2) == IDCANCEL)
return false;
DeleteFile(MDB_PathName);
}
WideString DataSource="Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + MDB_PathName;
try
{
Variant mdb = CreateOleObject("ADOX.Catalog");
try
{
mdb.OleFunction("Create",DataSource);
seccess = true;
}
__finally
{
mdb = Unassigned;
}
}
catch(...)
Ïà¹ØÎÊ´ð£º
Êý¾Ý¿âÁ¬½ÓÌáʾÈçϱ¨´í£¬¿´µÄ³öÀ´ÊÇÒ³ÃæÓëÊý¾Ý¿âÁ¬½ÓµÄÎÊÌ⣬ÏÖÔÚÎÒµÄÊÇÏà¶ÔÁ¬½Ó¡£
ÒªÔõô½«Æä¸Ã³É¾ø¶ÔÁ¬½ÓÄØ£¿ÎÒµÄÊý¾Ý¿âÎļþ·¾¶ÔÚ£º
D:\web\db
»¹ÊÇÒªÏÈлл´óÈËÃÇ°ïÖúС°×²ËÎÒ
Microsoft O ......
ÎÒÄ¿Ç°±íµÄÅÅÁÐÊÇÉÏÃæÕâÕÅͼÕâÇé¿ö£º
ÎÒÏ£Íûµ÷Õû³É£º
ÈçºÎ×öÄØ£¿
¸Õ²ÅÊÔÁËÏ£¬µã¡°¿ªÊ¼¡±--¡°ÊÓͼ¡±--¡°Éè¼ÆÊÓͼ¡±²»ÐÐ
PS£ºÎÒÓõÄÊÇaccess 2007£¬ÉÏÃæÕâ¸ö±íÊÇmdb¸ñʽµÄ
Ö÷²Ëµ¥£¬ ÊÓͼ ......
ÔÚMSSQLÖУ¬ÎÒÃÇ¿ÉÒÔÒ»´Î²éѯ¶à¸öÊý¾Ý±í²¢¼ÓÈëµ½Êý¾Ý¼¯ÖУ¬ÖмäÖ»ÐèÓ÷ֺŸô¿ª£®È磺
£¢select * from A;select * from B;select * from C£¢,Ìî³äÊý¾Ý¼¯ºóÔÚDSÖоÍÓÐÁËÈýÕÅ±í£®
µ«ÔÚÓÃͬÑùµÄÓï¾ä·ÃÎÊACCESSÊý¾ ......
ÇëÎʸ÷λ´óʦ£¬ÎÒÏÖÔÚÐèÒª½«XMLµÄÊý¾ÝʵʱµÄ´æÈëµ½Êý¾Ý¿âÖУ¬ÎÒÊÇÓÃasp±àµÄ³ÌÐò£¬´óÁ¿ÃÇ°ïæ·ÖÎö һϣ¡£¡£¡
ÏÂÃæÊÇÎÒµÄXMLÎļþ´úÂë
XML code:
<?xml version="1.0" encoding="utf-8"? ......
ÿ´ÎMFC³ÌÐòÍ˳öµÄʱºò ¶¼»á³öÏÖ
Unhandled exception at 0x035e1341 in cvPDM.exe: 0xC0000005: Access violation writing location 0x80517de0.
ÇëÎÊÕâ¸öÎÊÌâÓ¦¸Ã´ÓÄÄÀïÈëÊÖ½â¾ö £¿
ÓÐûÓÐÒ»Ì×ͨÓõĽ⾠......