View Issue Details

IDProjectCategoryView StatusLast Update
0025052LazarusDatabase Componentspublic2014-09-26 13:28
ReporterMike ThompsonAssigned ToJesus Reyes 
Status closedResolutionfixed 
PlatformWindowsOSWindows 8 OS Version64 bit
Product Version1.0.12Product Build 
Target Version1.2.0Fixed in Version1.1 (SVN) 
Summary0025052: TSQLQuery.Filter produces issues with TDBGrid
DescriptionConnect a TSQLQuery to a TDBGrid. Apply a TSQLQuery.Filter, then using the DBGrid vertical scroll bar to navigate through the records. Eventually you will hit a "Could not find the requested record".

I apologise, but I've been unable to get debugging inside FCL working, so I can't work out what's going on. The exception is being raised inside procedure TCustomBufDataset.SetRecNo(Value: Longint); I only know this as this is one of only places the exception gets raised, and the other location is apparently irrelevant.

This issue appears to be related to some other open issues relating to TSQLQuery.RecordCount ( I'm not adding this report to that issue because I agree with the assessment there that RecordCount shouldn't be updated automatically. It can be an expensive call sometimes...

Other than that small clue, I've no idea what's going on.

This issue has been confirmed with connections back to MySQL, SQLite and MS SQL, so appears to be database engine independent.

I have only tested this under Windows 8 64bit.
Steps To ReproduceRun the attached project (win 32 only I'm afraid). (I've included a compiled exe and the required SQLite dll)
Click btnConnect once.
Click btnAddRecords twice (each time adds 10,000 records).
Click btnFilter.
Try to scroll the DBGrid using the vertical scrollbar (grab the thumb, drag to a new position and let go.) Dragging may work a few times, but you'll eventually hit the problem (obviously when you finally end up on a record that the DBGrid thinks is still in the TDataset, but which the TDataset has filtered out).
Additional InformationOriginally reported over a year ago in the forums (,17615.0.html). We got sidetracked in the discussions there though...
TagsNo tags attached.
Fixed in Revision39124
Attached Files


related to 0022304 closedJesus Reyes DBGrid crash with filtered dataset after scroll 


Mike Thompson

2013-09-19 07:31


DBGrid_Error.7z (881,989 bytes)

Mike Thompson

2013-09-19 07:34

developer   ~0070181

Last edited: 2013-09-20 18:56

View 2 revisions

Typo in Description, and I can't work out how to edit the Issue :-(

  Apply a TSQLFilter.Query

should be

  Apply a TSQLQuery.Filter


Edit: Reinier Olislagers: bug reporters don't have permissions to edit the issue. I've applied your change. Thanks.

John Whitten

2013-09-20 18:25

reporter   ~0070214

I think the issue may be more directly related to the TDBGrid component (and derivatives) itself. For example, TKDBGrid does not seem to have this issue as it is a complete re-implementation/re-imagining of the DBGrid component concept which does not derive from TDBGrid.

Mike Thompson

2013-09-24 02:09

developer   ~0070293


As discussed in the forum topic (,17615.0.html, this issue has been resolved. And in fact, it was resolved in rev 39124, back in October last year (so, shortly after the topic was posted in the forum).

I could swear that I had tested this with 1.0.12. I'm sorry for wasting peoples time :-(

This issue can now be closed.

Issue History

Date Modified Username Field Change
2013-09-19 07:31 Mike Thompson New Issue
2013-09-19 07:31 Mike Thompson File Added: DBGrid_Error.7z
2013-09-19 07:34 Mike Thompson Note Added: 0070181
2013-09-20 18:25 John Whitten Note Added: 0070214
2013-09-20 18:55 Reinier Olislagers LazTarget => -
2013-09-20 18:55 Reinier Olislagers Description Updated View Revisions
2013-09-20 18:56 Reinier Olislagers Note Edited: 0070181 View Revisions
2013-09-24 02:09 Mike Thompson Note Added: 0070293
2013-09-24 18:42 Jesus Reyes Assigned To => Jesus Reyes
2013-09-24 18:42 Jesus Reyes Status new => assigned
2013-09-24 18:46 Jesus Reyes Relationship added related to 0022304
2013-09-24 18:48 Jesus Reyes Fixed in Revision => 39124
2013-09-24 18:48 Jesus Reyes LazTarget - => 1.2
2013-09-24 18:48 Jesus Reyes Status assigned => resolved
2013-09-24 18:48 Jesus Reyes Fixed in Version => 1.1 (SVN)
2013-09-24 18:48 Jesus Reyes Resolution open => fixed
2013-09-24 18:48 Jesus Reyes Target Version => 1.2.0
2014-09-26 13:28 Mike Thompson Status resolved => closed