Re: Ado, Threads (and videotape)
From: Guillem (guillemvicens_at_clubgreenoasis.com)
Date: 03/16/05
- Next message: Guillem: "Re: Ado, Threads (and videotape)"
- Previous message: Josu Z.: "Ado, Threads (and videotape)"
- In reply to: Josu Z.: "Ado, Threads (and videotape)"
- Next in thread: Guillem: "Re: Ado, Threads (and videotape)"
- Reply: Guillem: "Re: Ado, Threads (and videotape)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 16 Mar 2005 13:13:52 +0100
Hi,
"Josu Z." <josu@leako.com> escribió en el mensaje
news:4238146e$1@newsgroups.borland.com...
> Ado, Threads (and videotape)
> I have an object whose properties can be written and read form different
> threads.
>
> I protect the attributes with a TMultiReadExclusiveWriteSynchronizer.
>
> The thing is that i want some of these attributes be persistent in a
> Access BD (using ADO). I would like the object to write in the BD, within
> the SetValue functions of his properties.
>
> But doing this, I write in the BD within the context of the threads, and
> any of the thread should have his own ADOConnection. Shouldn't it?
No. You can have only one TADOConnection for it. Having multiple
TADOConnections has sense, for example, if you need to connect to multiple
databases and don't want to change the ConnectionString, but not for
threads.
IMO it's better to use a TCriticalSection or equivalent to assure that only
one thread is accessing to the TADOConnection. Also, on threads don't forget
to use CoInitialize before you use any ADO component and Couninitialize
after using it.
-- Best regards :) Guillem Vicens Dep. informática Green Service SA guillemvicens@clubgreenoasis.com www.clubgreenoasis.com
- Next message: Guillem: "Re: Ado, Threads (and videotape)"
- Previous message: Josu Z.: "Ado, Threads (and videotape)"
- In reply to: Josu Z.: "Ado, Threads (and videotape)"
- Next in thread: Guillem: "Re: Ado, Threads (and videotape)"
- Reply: Guillem: "Re: Ado, Threads (and videotape)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|