🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Code to Delete a Table from an MSAccess Database

#1815
From: Viatcheslav V. Vassiliev
Date: Fri, 06 Feb 2004 11:57
37 lines
2202 bytes
Try to connect with ADO connection and execute "DROP TABLE [TestTable]"

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Robert Emmons" <remmons@aurigen.com> ???????/???????? ? ???????? ?????????:
news:og8520d10kpvlonqulpj7o63duubouhha7@4ax.com...
> 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: <40238118$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.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
References: <og8520d10kpvlonqulpj7o63duubouhha7@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,adb51018ba023379
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-02-06 04:09:34 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <og8520d10kpvlonqulpj7o63duubouhha7@4ax.com>
Subject: Re: Code to Delete a Table from an MSAccess Database
Date: Fri, 6 Feb 2004 14:57:13 +0300
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 213.234.218.42
Message-ID: <40238118$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076068632 213.234.218.42 (6 Feb 2004 03:57:12 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.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