排序号码比发送到DB? [英] Sort Numbers than send to DB?

查看:72
本文介绍了排序号码比发送到DB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网络表单上有六个文本框控件,允许用户以任意顺序输入1到25之间的任何

数字。但是,在将这些数字发送到数据库之前,我想将这些数字从最小到最大排序。

如何完成这项任务?谢谢!

I have six textbox controls on my webform that allows the user to enter any
numbers from 1 to 25 in any order. However, I would like to sort those
numbers from least to greatest before sending them to the database. How can
accomplish this task? Thanks!

推荐答案

最简单的方法是使用ArrayList Sort方法。


//对不起,如果你正在寻找这个在vb

ArrayList list = new ArrayList();


list.Add(Int32.Parse(txt1.Text));

list.Add(Int32.Parse(txt2.Text));

list.Add(Int32.Parse(txt3.Text));

list.Add(Int32.Parse(txt4.Text));

list.Add(Int32.Parse(txt5.Text));

list.Add(Int32。 Parse(txt6.Text));


//这会将它们按顺序放在数组中。

list.Sort();


//这会立即将它们拉回来。

foreach(列表中的int i)

{


}


HTH,


bill

" Leon" < VN ***** @ msn.com>在消息中写道

新闻:eC ************** @ TK2MSFTNGP09.phx.gbl ...
Easiest way is to use the ArrayList Sort method.

//sorry if you were looking for this in vb
ArrayList list = new ArrayList();

list.Add( Int32.Parse( txt1.Text ) );
list.Add( Int32.Parse( txt2.Text ) );
list.Add( Int32.Parse( txt3.Text ) );
list.Add( Int32.Parse( txt4.Text ) );
list.Add( Int32.Parse( txt5.Text ) );
list.Add( Int32.Parse( txt6.Text ) );

//this will place them in order inside the array.
list.Sort();

//this will pull them back out in order now.
foreach( int i in list )
{

}

HTH,

bill
"Leon" <vn*****@msn.com> wrote in message
news:eC**************@TK2MSFTNGP09.phx.gbl...
我有六个文本框控件在我的webform上,允许用户以任何顺序输入1到25之间的任何数字
。但是,在将这些数字发送到数据库之前,我希望将这些数字从最小到最大排序。
如何完成这项任务?谢谢!
I have six textbox controls on my webform that allows the user to enter any numbers from 1 to 25 in any order. However, I would like to sort those
numbers from least to greatest before sending them to the database. How can accomplish this task? Thanks!



感谢您的回复!但是......

然后工作如何将已排序的数字应用到我的数据库存储过程

参数?


" William F. Robertson,Jr。 < wfrobertson_at_kpmg_dot_com>在消息中写道

新闻:%2 *************** @ TK2MSFTNGP14.phx.gbl ...
Thanks for your response! But...
but then how work apply the sorted numbers to my database stored procedure
parameters?

"William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
最简单的方法是使用ArrayList排序方法。

对不起,如果你在vb中寻找这个:ArrayList list = new ArrayList();

list.Add( Int32.Parse(txt1.Text));
list.Add(Int32.Parse(txt2.Text));
list.Add(Int32.Parse(txt3.Text));
list.Add(Int32.Parse(txt4.Text));
list.Add(Int32.Parse(txt5.Text));
list.Add(Int32.Parse(txt6.Text));

//这会将它们按顺序放在数组中。
list.Sort();

//这会立即将它们拉回来。
foreach(列表中的int)
{

}

HTH,

账单

" Leon" < VN ***** @ msn.com>在消息中写道
新闻:eC ************** @ TK2MSFTNGP09.phx.gbl ...
Easiest way is to use the ArrayList Sort method.

//sorry if you were looking for this in vb
ArrayList list = new ArrayList();

list.Add( Int32.Parse( txt1.Text ) );
list.Add( Int32.Parse( txt2.Text ) );
list.Add( Int32.Parse( txt3.Text ) );
list.Add( Int32.Parse( txt4.Text ) );
list.Add( Int32.Parse( txt5.Text ) );
list.Add( Int32.Parse( txt6.Text ) );

//this will place them in order inside the array.
list.Sort();

//this will pull them back out in order now.
foreach( int i in list )
{

}

HTH,

bill
"Leon" <vn*****@msn.com> wrote in message
news:eC**************@TK2MSFTNGP09.phx.gbl...
我的webform上有六个文本框控件允许用户以任何顺序输入
I have six textbox controls on my webform that allows the user to enter


任何

数字,从1到25。但是,在将这些数字发送到数据库之前,我希望将这些数字从最小到最大排序。怎么
numbers from 1 to 25 in any order. However, I would like to sort those
numbers from least to greatest before sending them to the database. How


可以

完成这个任务?谢谢!
accomplish this task? Thanks!




>但那么工作如何将已排序的数字应用于我的数据库存储过程
> but then how work apply the sorted numbers to my database stored procedure
参数?


查看存储过程及其参数以及从当前代码中填充它们的代码

后,我可以说你从未发布过

您的存储过程,参数或任何代码。


一次一个?非常小心?发布更多信息?


-

HTH,

Kevin Spencer

..Net开发人员

Microsoft MVP

跟随者既不是b $ b也不是贷款人。


" Leon" < VN ***** @ msn.com>在留言中写道

新闻:OH ************** @ TK2MSFTNGP14.phx.gbl ...感谢您的回复!但是......
然后工作如何将排序的数字应用到我的数据库存储过程
参数?

William F. Robertson,Jr。 < wfrobertson_at_kpmg_dot_com>在消息中写道
新闻:%2 *************** @ TK2MSFTNGP14.phx.gbl ...
parameters?
After looking over your stored procedure, and its parameters, and the code
that populates them from your current code, I can say that you never posted
your stored procedure, its parameters, or any of your code.

One at a time? Very carefully? Post more information?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Leon" <vn*****@msn.com> wrote in message
news:OH**************@TK2MSFTNGP14.phx.gbl... Thanks for your response! But...
but then how work apply the sorted numbers to my database stored procedure
parameters?

"William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
最简单的方法是使用ArrayList排序方法。

对不起,如果你在vb中寻找这个
ArrayList list = new ArrayList();

list.Add(Int32.Parse( txt1.Text));
list.Add(Int32.Parse(txt2.Text));
list.Add(Int32.Parse(txt3.Text));
list.Add( Int32.Parse(txt4.Text));
list.Add(Int32.Parse(txt5.Text));
list.Add(Int32.Parse(txt6.Text));

//这会将它们按顺序放在数组中。
list.Sort();

//这会立即将它们拉回来。
foreach(列表中的int)
{

}

HTH,

账单

"利昂" < VN ***** @ msn.com>在消息中写道
新闻:eC ************** @ TK2MSFTNGP09.phx.gbl ...
Easiest way is to use the ArrayList Sort method.

//sorry if you were looking for this in vb
ArrayList list = new ArrayList();

list.Add( Int32.Parse( txt1.Text ) );
list.Add( Int32.Parse( txt2.Text ) );
list.Add( Int32.Parse( txt3.Text ) );
list.Add( Int32.Parse( txt4.Text ) );
list.Add( Int32.Parse( txt5.Text ) );
list.Add( Int32.Parse( txt6.Text ) );

//this will place them in order inside the array.
list.Sort();

//this will pull them back out in order now.
foreach( int i in list )
{

}

HTH,

bill
"Leon" <vn*****@msn.com> wrote in message
news:eC**************@TK2MSFTNGP09.phx.gbl...
我的webform上有六个文本框控件允许用户以任何顺序输入
I have six textbox controls on my webform that allows the user to enter


任何

数字,从1到25。但是,在将这些数字发送到数据库之前,我希望将这些数字从最小到最大排序。怎么
numbers from 1 to 25 in any order. However, I would like to sort those
numbers from least to greatest before sending them to the database. How


可以

完成这个任务?谢谢!
accomplish this task? Thanks!





这篇关于排序号码比发送到DB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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