Jump to content
Flavio Basile

[Firedac] SQLServer Table Locked

Recommended Posts

Hi All.

I'm using Firedac to connect my VCL Application with SQLServer.

Since some weeks, I have strange Lock on tables.
I have a FDQuery whit a simple "Select * from MyTable". I show the result with a DBGrid (a simple DBGrid).

Another User opens a form with a FDQuery: "Select * from MyTable where ID = 1". The FDQuery is in Cached Update. When the user POST the data, the application of the user that has the first form whit the DBGrid, freeze. And also the user that has posted the data will be freezed.

An important think is that the table on DB has 2 triggers that fire when the table has changed and that makes computation on field of the table.

 

I have created a T-SQL function that gives to me information about lock: the dataset that are opened for that table are in the list.

 

There is something that I need to do to prevent this error?

 

Thanks, 

Flavio

Edited by Flavio Basile

Share this post


Link to post
17 hours ago, Flavio Basile said:

Hi All.

Another User opens a form with a FDQuery: "Select * from MyTable where ID = 1". The FDQuery is in Cached Update. When the user POST the data, the application of the user that has the first form whit the DBGrid, freeze. And also the

Flavio

Basic components or objects to use with FireDAC or any other similar:

  • FDGUIxWaitCursor -- Use TFDGUIxWaitCursor to add the IFDGUIxWaitCursor interface implementation to your application. This implementation is mandatory for FireDAC applications.
  • FDPhysXXXXXXXXDriverLink -- to access your DB internal command / appropriated for each DB
  • FDConnection -- to define the string connection and others params
  • FDTransaction -- preference 2 components = 1 for READ-ONLY (selects) and 1 for READ-WRITE (updates / deletes) for example!
    • FDConnection.Transaction = FDTransactionREADONLY component = [ ReadCommitted ] to "see" the updates from another users!
    • FDConnection.UpdateTransaction = FDTransactionREADWRITE component = [ ReadCommitted ]
    • when you dont use any component/object for Transaction, you force the FireDAC to use the "internal" transaction components -- managed by FireDAC!
    • when you use "your" TRANSACTION components, you are responsable by him! -- if you active, then, you deactive! (create/free/ etc...)
  •  
Edited by emailx45

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×