From 2ded25f76c75e95dc43ff919bd001d0995107a69 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 26 Jan 2021 21:46:25 +0100 Subject: [PATCH] Fix empty query body when deleting grid rows in MSSQL mode, broken in b9b5976413dc6ff35e9e947816cc7264161b88f1. Closes #1294 --- source/dbconnection.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index df1bc3f4..8adbcd3c 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -6696,7 +6696,7 @@ begin Result := QueryType + ' '; case FParameters.NetTypeGroup of ngMSSQL: begin - if QueryType = 'UPDATE' then begin + if (QueryType = 'UPDATE') or (QueryType = 'DELETE') then begin // TOP(x) clause for UPDATES + DELETES introduced in MSSQL 2005 if ServerVersionInt >= 900 then Result := Result + 'TOP('+IntToStr(Limit)+') '; @@ -6711,7 +6711,8 @@ begin // OFFSET not supported in < 2012 Result := Result + 'TOP ' + IntToStr(Limit) + ' ' + QueryBody; end; - end; + end else + Result := Result + QueryBody; end; ngMySQL: begin Result := Result + QueryBody + ' LIMIT ';