Home > Back-end >  Questions about Delphi database multi-user operating
Questions about Delphi database multi-user operating

Time:09-23

Environment: the Delphi XE7 + SQL 2008
Question: about Delphi database multi-user operating problems

Problem description:
Use Delphi controls: TADOQuery TADOConnection + + TDataSource + cxgrid + cxdbedit
ADOQuery. LockType:=adLockOptimistic;

Each time only one record for "increase bowdlerize";

To add/change process:

Click the button "new"
Dm. ADOConnection1. BeginTrans;
With the dm. ADOQuery1 do
The begin
The open;
Edit;
Append.
end;

-- -- -- -- -- -- -- -- -- -- need to enter a period of time -- -- -- -- -- -- -- -- -- --
Wait for the user to change the data on the interface, use data-bound controls: cxdbedit


Click the button "save"
Dm. ADOQurry1. Post;
Dm.ADOConnection1.Com mitTrans;

Question: because the multi-user operating at the same time, and the process cost long time comparison.
Led to record A submission database records have been changed, cause the failure of data preservation,
Especially the user more cases,

If use ADOQuery. LockType:=adLockPessimistic;
The changes to the data, other users can use to access the data, other users waiting for a long time

Multi-user system, update the fields, the use which approach is more appropriate?

CodePudding user response:

Concurrently, are they not so?
After a man saved is only his luck.
Who let him with somebody else take the same data didn't rob somebody else.

CodePudding user response:

You are through ADOQuery. LockType:=adLockOptimistic find rows of data, the corresponding data set only one (line),
Of course only to increase the deletion of a,

CodePudding user response:

It is best to three layer structure, in the application server database operation,
Or is executing SQL statements, "the update table set,,,,," let the database to decide who is going to change,

CodePudding user response:

Increases the censored not should be the primary key operation? How can save failed?????????? If it is on the ID, is also increasing database main key automatic judgment

CodePudding user response:

Multi-user operating, can not increase more than, you can only lock, someone edit, others cannot operation, feel better point under the new added is a new data, and lock the user,

CodePudding user response:

I don't have to ado dbexpress I can use to access the database

CodePudding user response:

C/S, so generally by role separate operation, but can be multiple users to edit, a kind of way is to edit a update one, the other at the same time to edit the same record is too special, the primary key is the only,

CodePudding user response:

Writing has a problem you should use the tclientdataset, submit its delta save, can't directly open the data table, open the transaction at the same time, serious can't operation,

CodePudding user response:

Use multiple users better INSERT + UPDATE, not recommend the use of other skills, or with the greater the amount of data, the greater the chance of error

CodePudding user response:

Multi-user operating the same records, if you modify the same record of the same field, that what is the point,
If is to modify different field, then get a state, form a workflow,

CodePudding user response:

It is recommended to use DataSnap three layers, in this way, the server data, each user, the data can be read at any time, other users, while others are modified reads is the new data,
  • Related