Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是免费的 pascal 和 lazarus 的新手,我想知道如何从 tbgrid 中的选定行获取行数据(例如 id 列)?
网格链接到数据集。数据集有一个活动行,您可以使用它。
对于未来的寻求者来说,迟到总比没有好。考虑您有一个整数值(如您所说的主列 ID)。在滚动事件后的 SQLQuery 中,执行如下操作:
procedure TMainform1.SQLQuery1AfterScroll(DataSet: TDataSet); Var id:Integer; Begin id := DBGrid1.Columns.Items[0].Field.AsInteger; end;