🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1814

Code to Delete a Table from an MSAccess Database

#1814
From: Robert Emmons
Date: Thu, 05 Feb 2004 20:10
22 lines
1592 bytes
I'm trying to write code to delete a table from an MSAccess database.
My code compiles, but does not delete the table.  I would appreciate
any suggestions.  Here is the code:


    WideString thisDb  = "C:\\data\\HitTemp.mdb";
    WideString thisTbl = "TestTable";

    Variant thisDbConnectStr =
WideString("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + thisDb);


    Adox_tlb::TCOM_Catalog cat = CoCatalog::Create();
    cat->set_ActiveConnection(thisDbConnectStr);

    Adox_tlb::TCOM_Table tbl = CoTable::Create();
    tbl->set_Name(thisTbl.c_bstr());
    tbl->ParentCatalog = cat;

    cat->Tables->Delete(Variant((IDispatch*)tbl));
    cat->Tables->Refresh();
//    cat->Release();
Technical Details
Message-ID: <og8520d10kpvlonqulpj7o63duubouhha7@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,adb51018ba023379,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-02-05 12:10:47 PST
From: Robert Emmons <remmons@aurigen.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Code to Delete a Table from an MSAccess Database
Date: Thu, 05 Feb 2004 15:10:26 -0500
Message-ID: <og8520d10kpvlonqulpj7o63duubouhha7@4ax.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 68.193.14.50
X-Trace: newsgroups.borland.com 1076011688 68.193.14.50 (5 Feb 2004 12:08:08 -0800)
Lines: 25
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail