如何根据文本框中输入的数值数据显示datagridview内数据库中的数据? [英] How to display data from the database inside datagridview based from the inputted numeric data in the textbox?
本文介绍了如何根据文本框中输入的数值数据显示datagridview内数据库中的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨。
我想知道是否可以根据用户在文本框中输入的数字数据在datagridview中显示数据。 />
例如,用户在文本框中输入5。单击create按钮后,datagridview将仅显示5条记录。我怎样才能做到这一点?
任何人都可以给我一些链接和一些代码,如果可能的话,这样做吗?
Hi.
I would like to know if it is possible to display data inside datagridview based from the numeric data inputted by the user in the textbox.
For example, the user input 5 in the textbox. After clicking the button create, datagridview will display 5 records only. How can I do that?
Can anyone give me some links and some codes, if may be, to do this?
推荐答案
当您从数据库中获取数据时,您可以限制记录数量,为您的数据库使用相关的sql语法
check http://www.w3schools.com/sql/sql_top.asp [ ^ ]
when you fetch data from database you can limit number of records, use relevant sql syntax for your database
check http://www.w3schools.com/sql/sql_top.asp[^]
当然可以。
您可以在datagridview中应用分页并保持页面大小按照文本框中提供的值。
您可以参考这个 [ ^ ]了解如何实现分页。
Of course it is possible.
You can apply paging in datagridview and keep your page size as per the value provided in textbox.
You can refer this[^] article to know about implementing paging.
这篇关于如何根据文本框中输入的数值数据显示datagridview内数据库中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文