问题描述
我已使用查询搜索数据库。
I have searched a database using a query.
搜索结果显示在DBGrid组件中,供用户选择希望继续的行。
The results of the search are displayed in a DBGrid component for the user to select the row s/he wishes to proceed with.
DBGrid始终将记录指针设置为结果集中的第一条记录,因此默认情况下始终选择一行。我需要将此行为更改为在首次显示数据时不选择任何行,以便可以确定用户是否实际进行了选择。
DBGrid always sets the record pointer to the first record in the results set, so a row is always "selected" by default. I need to change this behaviour to no row being selected when the data is first presented so that I can determine if the user has actually made a selection.
是否可以告诉是否没有选择,即用户没有选择任何行?
Is it possible to tell if no selection has been made, i.e. no row has been selected by the user?
任何帮助都非常欢迎!
推荐答案
您可以包括dgMultiSelect到DBGrid.Options中,然后DBGrid.SelectedRows将包含明确选择的记录书签的列表。如果没有dgMultiSelect,DBGrid将始终跟踪当前数据集记录。
You can include dgMultiSelect into DBGrid.Options, then DBGrid.SelectedRows will contain list of explicitly selected record bookmarks. Without dgMultiSelect the DBGrid always track the current dataset record.
这篇关于Delphi-使用DBGrid从搜索中选择行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!