all groups > sql server misc > december 2003 >
You're in the

sql server misc

group:

Reordering


Reordering Dmitri Shvetsov
12/22/2003 4:25:13 PM
sql server misc:
Hi,

I'm working with the MSSQL 2000 and C#.

When I load my data from the database table in a DataSet I use the query to
order all records by some column. Then I can work with these records, show
them, edit, correct, insert, etc. It's done and works fine.

The problem is to change the order of these records using a simple
renumbering of this ORDER_BY column directly in a dataset. It's only one
column that I should use for this reordering and I always know which one I
need to use.

The first idea was to use a Drag-n-Drop feature and just to use a mouse to
capture and to move a required record from place to place. But physically
the records consist of many fields and it's a problem to show them correctly
in one string. So, I can't decide what component could I use for this
drag-n-drop operation? DropDownList or what?

Maybe somebody has a better idea how can we reorder the records directly in
a DataSet changing the int values in one selected column?

Thanks,
Dmitri

Re: Reordering John Bell
12/28/2003 6:34:24 PM
Hi

I think the quickest way would be to do this on the client (I think the
datagrid control can do this.. but this is not my area or expertise!),
otherwise you will be fetching the data again from the server..

You can use dynamic SQL to create the correctly ordered result set, check
out (especially the case statements in the order by clause):
http://www.sommarskog.se/dynamic_sql.html
and well worth additional reading:
http://www.sommarskog.se/dyn-search.html

John

[quoted text, click to view]

AddThis Social Bookmark Button