ListView控件通过SQL查询显示记录 [英] ListView Control Displaying Records through a SQL Query
本文介绍了ListView控件通过SQL查询显示记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ListView控件应根据查询显示SQL表的记录.
它应该具有列标题,并且当我们按下向下箭头时,它应该选择行的所有列.
请使用静态列号告诉要获取特定单元格值的代码是什么.和动态行号在运行时.
解决方案
如果您在填写列表视图时遇到问题,也许这会有所帮助: ^ ]
关于选择,您可以使用 ListView.SelectedItems属性 [ ^ ].然后,您可以从适当的子项中获取值,或者从数据表中获取值可能会更好.
来自 information_schema.columns 其中 table_name = ' MenuItems' 顺序 通过顺序位置
上面的查询将重新运行属于特定表的列名称
http://doitdotnet.wordpress.com/2011/12/21/how-to-get-all-field-names-in-a-table-using-sql-query/ [ 解决方案
If you''re having problems in filling the listview, perhaps this would help: http://www.akadia.com/services/dotnet_listview_sort_dataset.html[^]
About the selection, you can use ListView.SelectedItems Property [^]. Then you can either get the value from the proper subitem or perhaps it would be better to get it from the datatable.
select column_name from information_schema.columns where table_name = 'MenuItems' order by ordinal_position
Above query will retrun the column names belong to specific table
http://doitdotnet.wordpress.com/2011/12/21/how-to-get-all-field-names-in-a-table-using-sql-query/[^]
You can get the column names using the above query by passing the table as a parameter. then in the selected index changed you can pass the column name paramter to a query which will return all the values of that column in table rows
这篇关于ListView控件通过SQL查询显示记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文