Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Updatring MS/SQL table from a DBGRID does not work?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Aug 27, 2017 11:56 PM Last Post By: Bernd Maierhofer
Jan Erik Roed

Posts: 2
Registered: 8/18/16
Updatring MS/SQL table from a DBGRID does not work?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 16, 2017 6:28 PM
I am on Delphi 10.2
Using Microsoft SQL Server 2014 (SP1-CU13) (KB4019099) - 12.0.4522.0
(X64) Jun 28 2017 17:36:31
Copyright (c) Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3
<X64> (Build 15063: ) I have a select statement : Select * from
manufacturers order by name The DBGRID is linked to a Datasource and
datasource linked to a FDQuery - FDQuery linked to a FDConnection.
When I try to update a column in the DBGRID the application and post,
it gives me this error message: [firedac][phys][odbc][microsoft][SQL
server Native Client 11.0][SQL server] Transaction (Process ID 51)
was deadlocked on lock | generic waitable object resources with
another process and has been chosen as the deadlock victim. Rerun the
transaction.

When I remove the "order by name" from the select it happily updates
the table. I have not changed any defaults anywhere.
Hope somebody can help out.
Thanks in advance.
Best regards
Jan Erik Roed
Bernd Maierhofer

Posts: 161
Registered: 9/27/99
Re: Updatring MS/SQL table from a DBGRID does not work?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 27, 2017 11:56 PM   in response to: Jan Erik Roed in response to: Jan Erik Roed
Jan Erik Roed wrote:

I am on Delphi 10.2
Using Microsoft SQL Server 2014 (SP1-CU13) (KB4019099) - 12.0.4522.0
(X64) Jun 28 2017 17:36:31
Copyright (c) Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3
<X64> (Build 15063: ) I have a select statement : Select * from
manufacturers order by name The DBGRID is linked to a Datasource and
datasource linked to a FDQuery - FDQuery linked to a FDConnection.
When I try to update a column in the DBGRID the application and post,
it gives me this error message: [firedac][phys][odbc][microsoft][SQL
server Native Client 11.0][SQL server] Transaction (Process ID 51)
was deadlocked on lock | generic waitable object resources with
another process and has been chosen as the deadlock victim. Rerun the
transaction.

When I remove the "order by name" from the select it happily updates
the table. I have not changed any defaults anywhere.
Hope somebody can help out.
Thanks in advance.
Best regards
Jan Erik Roed

Have a look at the WITH (NOLOCK) hint for MSSQL. Maybe this helps you
out.

Additionally check if there is a index on name.

HTH Bernd

--
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02