Probably already know the answer to this problem, but perhaps i am wrong.

My datagrid is being sorted by Id which is Autonumber.
So if i add a new entry its added at the bottom of the list.
Is there any way to change the sorting to a different nummeric column?

In my database i got a number column which of course if nummeric.
If 5 records got the number 1 in that column and a 6th is added with 1 it currently remains at the bottom.
Clicking the column will order them together, but this will order everything.
Basically its somewhat like adding a new entry in between other entries, instead of just adding a entry to the bottom.

Recommended Answers

Your select statement for your datagridview can be edited to order by the column chosen.

For example:

"SELECT * FROM Table ORDER BY Column4 ASC"

Will sort data by column for ascending.

For decending just do the opposite:

"SELECT * FROM Table ORDER …
Jump to Post

All 2 Replies

Your select statement for your datagridview can be edited to order by the column chosen.

For example:

"SELECT * FROM Table ORDER BY Column4 ASC"

Will sort data by column for ascending.

For decending just do the opposite:

"SELECT * FROM Table ORDER BY Column4 DESC"

Yeah i had something similar, i am guessing this is the only option to do it.

Column Asc/Desc has a odd way of doing it, it works though.

Just not the way you would want it when doing it with a numeric column.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.