🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
4 messages
4 total messages Started by Juan Jos� S�nchez Tue, 27 Mar 2001 02:50
Multi-user access to ADO database
#5644
Author: Juan Jos� S�nchez
Date: Tue, 27 Mar 2001 02:50
35 lines
2252 bytes
Hi all!

I've tried to write two clients that access the same database (MS Access
2000) via OLEDB driver for Microsoft Jet 4.0, the problem is that the
EOLEException ( ' The especified row could not be located for updating.Some
values may hace been changed since it was last read ' ) occured when each
application tried to write different data in the same record NOT
SIMULTANEOUSLY.
Here are the main code of both clients:

Client 1
...
void __fastcall TForm1::Button1Click(TObject *Sender)
{                                                                                       
    ADODataSet1->Refresh();                                            
    ADODataSet1->Edit();                                                  
    ADODataSet1->FieldValues["FIELD1"] = 1;
    ADODataSet1->Post();
}

Client 2
...
void __fastcall TForm2::Button1Click(TObject *Sender)   
{                                                                                       
    ADODataSet1->Refresh();                                            
    ADODataSet1->Edit();                                                  
    ADODataSet1->FieldValues["FIELD1"] = 2;
    ADODataSet1->Post();
}

How can any clients write data to the same database correctly? Should I consider some settings to my ADOConnection that I have ignored?

Note: When only one client writes to the database and the other reads there wasn't any problem.

Thanks all
Re: Multi-user access to ADO database
#5653
Author: Mark Cashman
Date: Wed, 28 Mar 2001 03:22
13 lines
1392 bytes
Hi, Juan!

Make sure you have a primary key index. Also keep in mind that Refresh
will cause your cursor to move unpredictably.

------
Mark Cashman (TeamB - C++ Builder), creator of The Temporal Doorway at
http://www.temporaldoorway.com
- Original digital art, writing, music and more -
C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
(Join us!)
http://www.temporaldoorway.com/programming/index.htm
------
Re: Multi-user access to ADO database
#5657
Author: Juan Jos� S�nchez
Date: Wed, 28 Mar 2001 17:16
32 lines
2042 bytes
Hi, Mark!

I had already a Primary Key in my database, and I've changed the code as
follows:

Client 1
...
void __fastcall TForm1::Button1Click(TObject *Sender)
{                                                                                       
    ADODataSet1->Refresh();                                            
    ADODataSet1->First();
    ADODataSet1->Edit();                                                  
    ADODataSet1->FieldValues["FIELD1"] = 1;
    ADODataSet1->Post();
}

Client 2
...
void __fastcall TForm2::Button1Click(TObject *Sender)   
{                                                                                       
    ADODataSet1->Refresh();                                            
    ADODataSet1->First();
    ADODataSet1->Edit();                                                  
    ADODataSet1->FieldValues["FIELD1"] = 2;
    ADODataSet1->Post();
}

But the same error occurs, could you tell me any safe way of doing this?

NOTE: Changing Refresh() by Close() + Open() solves the problem but it's extremely slow.

Thanks Mark for your attention!!
Re: Multi-user access to ADO database
#5575
Author: Mark Guerrieri
Date: Fri, 30 Mar 2001 16:00
53 lines
2566 bytes
What I do is use a seperste TADOCommand object with an UPDATE statement to
write.  You still need to Requery/Refresh/Reopen your dataset to see the
changes, but you can write whatever you want whenever you want.  The problem
has to do with ADO/Jet using the entire record for updates.  This could also
happen if you changed a fields in the Primary Key.

Mark



"Juan Jos� S�nchez" <JUANJOSE94@terra.es> wrote in message
news:3abfffb9_2@dnews...
> Hi all!
>
> I've tried to write two clients that access the same database (MS Access
> 2000) via OLEDB driver for Microsoft Jet 4.0, the problem is that the
> EOLEException ( ' The especified row could not be located for
updating.Some
> values may hace been changed since it was last read ' ) occured when each
> application tried to write different data in the same record NOT
> SIMULTANEOUSLY.
> Here are the main code of both clients:
>
> Client 1
> ...
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
>     ADODataSet1->Refresh();
>     ADODataSet1->Edit();
>     ADODataSet1->FieldValues["FIELD1"] = 1;
>     ADODataSet1->Post();
> }
>
> Client 2
> ...
> void __fastcall TForm2::Button1Click(TObject *Sender)
> {
>     ADODataSet1->Refresh();
>     ADODataSet1->Edit();
>     ADODataSet1->FieldValues["FIELD1"] = 2;
>     ADODataSet1->Post();
> }
>
> How can any clients write data to the same database correctly? Should I
consider some settings to my ADOConnection that I have ignored?
>
> Note: When only one client writes to the database and the other reads
there wasn't any problem.
>
> Thanks all
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads