From 40290e4ef8d6b86664489c4f2073076fa91ebe53 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Fri, 22 Apr 2011 06:44:23 +0000 Subject: [PATCH] Create new data grid result object each time, so it's of the right vendor type. Fixes an access violation when switching to a table in another connection. See http://www.heidisql.com/forum.php?t=8306 --- source/main.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/main.pas b/source/main.pas index 027d8e71..a7c88243 100644 --- a/source/main.pas +++ b/source/main.pas @@ -4023,9 +4023,12 @@ begin try ShowStatusMsg('Fetching rows ...'); - if not Assigned(DataGridResult) then + // Result object must be of the right vendor type + if not RefreshingData then begin + FreeAndNil(DataGridResult); DataGridResult := DBObj.Connection.Parameters.CreateQuery(Self); - DataGridResult.Connection := ActiveConnection; + end; + DataGridResult.Connection := DBObj.Connection; DataGridResult.SQL := Select; DataGridResult.Execute(Offset > 0); DataGridResult.ColumnOrgNames := WantedColumnOrgnames;