在c#中设置最小值和最高值记录 [英] Setting the minimum and highest values records in c#

查看:257
本文介绍了在c#中设置最小值和最高值记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如何将最小值设置为最低记录数,将最大值设置为c#中的最高记录?我基本上试图将进度条与我的数据库链接。

谢谢您的时间。

Hi guys,
How do I set the minimum value to be the lowest record number and the maximum value to be the highest record in c#? I am basically trying to link a progress bar with my database.
Thank you for your time.

推荐答案

假设我在评论中对您的问题有所了解:



您必须将您的要求分成简单的部分;可能是:



1)查询数据库以获得最小和最大整数值记录数;将此值存储到两个整数变量中。



2)使用在阶段1获得的值分配ProgressBar的最小值和最大值属性。 />


这就像这一样微不足道。哪个部分有问题?



看到你的回复后:你需要从数据库中检索记录的数量。这样,ProgressBar的Maximum属性设置为检索的记录数。 [/ Edit]
Assuming what I understand from your question in my comment:

You have to separate your requirement into simple parts; which could be:

1) Query the database to get minimum and maximum integer values the count of records; store this value into two integer variables.

2) Assign your ProgressBar's Minimum and Maximum property with the value obtained at stage 1.

That's as trivial as this. Which part do you have problems with?

After seeing your reply : you need the count of the records you are retrieving from the database. This way, the Maximum property of the ProgressBar is set to the number of records retrieved. [/Edit]


解决方案1 ​​by phil.o [ ^ ]是很好。除此之外,我想说最小值始终为0(零),最大值等于满足条件减去1的记录数。 (谢谢你,谢尔盖)。



另外,你可以将数据加载到DataTable中 [ ^ ]对象比使用它属性:DataTable.Rows.Count [ ^ ]定义进度条的最大值。
Solution 1 by phil.o[^] is very good. In addition of it, i would like to say that the minimum value is always 0 (zero) and the maximum is equal to count of records that meets the criteria minus one. (Thank you, Sergey).

Alternatively, you can Load data into DataTable[^] object than use it property: DataTable.Rows.Count[^] to define maximum value for progressbar.


这篇关于在c#中设置最小值和最高值记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆