Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Databases
»
DbGrid or TSQLQuery best option
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
OpenDocument('Filename') ...
by
cdbc
[
Today
at 12:45:35 pm]
lazbuild vs IDE: PPU chec...
by
Martin_fr
[
Today
at 11:49:14 am]
TCollection wiki entry
by
Thaddy
[
Today
at 10:56:03 am]
Need help with fphttpserv...
by
ArminLinder
[
Today
at 10:55:51 am]
Install new .deb over exi...
by
Thaddy
[
Today
at 07:16:45 am]
I have made some progress...
by
egsuh
[
Today
at 05:36:50 am]
equivalent to C/C++ "offs...
by
Fibonacci
[
Today
at 03:40:37 am]
Lazarus Main not building...
by
dbannon
[
Today
at 03:01:32 am]
Lazarus interface to Rexx...
by
mdlueck
[July 13, 2026, 09:52:18 pm]
LazSWatch - a serial port...
by
CM630
[July 13, 2026, 08:17:10 pm]
WASM import error
by
lebao3105
[July 13, 2026, 05:51:47 pm]
Lazarus Bugfix Release 4....
by
n7800
[July 13, 2026, 04:56:57 pm]
Discipline your AI coding...
by
Weiss
[July 13, 2026, 04:37:42 pm]
Hello. I'm new to this co...
by
zeljko
[July 13, 2026, 02:17:38 pm]
weird error message
by
cdbc
[July 13, 2026, 12:23:13 pm]
Freepascal
by
LeP
[July 13, 2026, 09:40:33 am]
TTL Record Count, i.e. a ...
by
Zvoni
[July 13, 2026, 09:10:08 am]
Printing on HP Smart Tank
by
Thaddy
[July 13, 2026, 07:10:37 am]
P.I.S.S. a PlugIn-framewo...
by
cdbc
[July 13, 2026, 06:38:27 am]
MVP made easier.
by
cdbc
[July 13, 2026, 06:18:24 am]
Lazarus 4.6 may erase you...
by
Martin_fr
[July 12, 2026, 06:35:29 pm]
Best name for procedure
by
LemonParty
[July 12, 2026, 05:23:02 pm]
Fixed an RV32ec compiler ...
by
MattBradford
[July 12, 2026, 05:11:16 pm]
Many recent books on Laza...
by
Tomu
[July 12, 2026, 05:02:44 pm]
International Pascal Cong...
by
zeljko
[July 12, 2026, 04:08:53 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: DbGrid or TSQLQuery best option (Read 1011 times)
eldonfsr
Hero Member
Posts: 598
DbGrid or TSQLQuery best option
«
on:
March 05, 2025, 03:42:43 pm »
Hi i have a problem do you know when we have dbgrid user can go down or up how can know when he move to next record or select record to update a tabcontrol where is locate dbgrid...filter record on another table...
afterscroll or beforescroll , datasource or ondatachange
Thanks
Logged
TRon
Hero Member
Posts: 4377
Re: DbGrid or TSQLQuery best option
«
Reply #1 on:
March 05, 2025, 04:02:46 pm »
Based on the description, though I have to guess a bit, you are probably referring to a master-detail solution.
See also
our wiki
where the concept is explained and an example provided.
Here
is another example (though it is quite old and I do not know if it still builds).
«
Last Edit: March 05, 2025, 04:08:50 pm by TRon
»
Logged
Today is tomorrow's yesterday.
egsuh
Hero Member
Posts: 1818
Re: DbGrid or TSQLQuery best option
«
Reply #2 on:
March 06, 2025, 05:10:34 am »
In addition to TRon's comment, you should focus on 'TDataSet descendants', e.g. TSQLQuery, not TDBGrid. What DBGrid does is to show the state of TDataSet. Filtering, etc. should be done on TDataSet descendants.
Logged
wcage03
New Member
Posts: 27
Re: DbGrid or TSQLQuery best option
«
Reply #3 on:
March 18, 2025, 07:32:28 pm »
The DBGrid will show you visually which row you are on in the dataset. The SQLQuery will actually be tracking to the specific row. You can do something like SQLQuery1.FieldByName('SomeField').AsString (or AsInteger, etc.) to grab the value of a field on the row that the DBGrid shows as selected. The DBGrid does a lot of additional things, but one thing it does is act sort of like a navigator within the dataset.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Databases
»
DbGrid or TSQLQuery best option
TinyPortal
© 2005-2018