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

This commit is contained in:
Ansgar Becker
2011-04-22 06:44:23 +00:00
parent 1021dc3888
commit 40290e4ef8

View File

@@ -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;