We need to see the code that you have now that is sending to database. I
will try to guess what you want.
ArrayList list = new ArrayList();
//add the numbers to the list
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 sort the numbers
list.Sort();
SendToDatabase( list[0] );
SendToDatabase( list[1] );
SendToDatabase( list[2] );
SendToDatabase( list[3] );
SendToDatabase( list[4] );
SendToDatabase( list[5] );
This will send the numbers in order to the database. This is assuming you
have a method defined called SendToDatabase(). And inside this method you
make your database connection, create your command text, etc. If you need
help on inserting something to a database then ask that question, but add
things like....Sql Server, Access, using Stored Procedures, Xml DataSet,
etc.
We will all need more information if this is not what you are looking for.
Your original question was how to sort them BEFORE sending to the
database.
The list.Sort() method will sort them.
If you have another question, please ask it, but repeating your first
question will just get a similiar answer.
bill
Leon said:
Thanks for your response.. But
I don't understand what you mean by..
"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."
This is my original question..
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 again!