🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Creating MS Access Database (revisited)

#1945
From: Simon Elliott
Date: Mon, 29 Dec 2003 11:30
21 lines
1621 bytes
I'm creating an MS Access database with:

Variant Catalog;
Variant Connection;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
Catalog=Variant::CreateObject("ADOX.Catalog");
Catalog.Exec(Function("Create") << strConnectionString);
Connection = Catalog.Exec(PropertyGet("ActiveConnection"));
...
Connection.Exec(Function("Close"));
CoUninitialize();

Do I need to do anything special to close/release Catalog and
Connection? 

What happens if Catalog and Connection go out of scope after the
CoUninitialize() call? Will this mean that an implicit close/release
happens after CoUninitialize(), and if so, will this cause problems?
-- 
Simon Elliott
http://www.ctsn.co.uk/
Technical Details
Message-ID: <DlNlsBA9AB8$Iwut@courtlands.demon.co.uk>
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!courtlands.demon.co.uk!simon

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,1386b963f53820e2,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-12-29 03:39:17 PST
Message-ID: <DlNlsBA9AB8$Iwut@courtlands.demon.co.uk>
Date: Mon, 29 Dec 2003 11:30:05 +0000
From: Simon Elliott <simon@nospam.demon.co.uk>
Reply-To: Simon Elliott <news@nospam.demon.co.uk>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Creating MS Access Database (revisited)
Lines: 27
Organization: Courtlands Technical Services
MIME-Version: 1.0
X-Newsreader: Turnpike Integrated Version 4.02 U <aLIvuQCpEWZ0Tu7eytpxRhrSSE>
NNTP-Posting-Host: 158.152.154.121
X-Trace: newsgroups.borland.com 1072697416 158.152.154.121 (29 Dec 2003 03:30:16 -0700)
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!courtlands.demon.co.uk!simon