🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

ADO in threads

#3824
From: Don Wilcox
Date: Mon, 03 Jun 2002 15:39
10 lines
1479 bytes
I have a multi-threaded program that is going to need to update a SQL Server DB. How do I setup the connection objects for each thread? I tried creating a single connection object on the UI form and sharing it among the various threads. This doesn't give me any initial problems, but I worry about threading issues.

I tried dropping a separate TADOConnection object on the UI form for each thread, but if the thread attempts to set Connected to true, the program raises the exception EOleException 'CoInitialize has not been called'.

In short, what is the correct mechanism for using TADOConnections in multi-threaded apps?

Thanks,

Don
Technical Details
Message-ID: <3cfb8db2$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!telocity-west!TELOCITY!fr.clara.net!heighliner.fr.clara.net!213.73.101.75.MISMATCH!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,9e323c4b5b0bb71b,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-06-03 08:40:46 PST
From: "Don Wilcox" <dwilcox@dfsaz.com>
Sender: "Don Wilcox" <dwilcox@dfsaz.com>
Reply-To: "Don Wilcox" <dwilcox@dfsaz.com>
Subject: ADO in threads
Newsgroups: borland.public.cppbuilder.database.ado
X-User-Info: 65.160.60.130 65.160.60.130    
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3cfb8db2$1_1@dnews>
Date: 3 Jun 2002 08:39:30 -0700
X-Trace: dnews 1023118770 207.105.83.65 (3 Jun 2002 08:39:30 -0700)
Lines: 10
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!telocity-west!TELOCITY!fr.clara.net!heighliner.fr.clara.net!213.73.101.75.MISMATCH!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!dnews