Reorder DataSet

D

Dmitri Shvetsov

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
 
F

Frank Oquendo

Dmitri said:
When I load my data from the database table in a DataSet I use the
query to order all records by some column.

You can speed up the process considerably setting the Sort property of
your DataTables' DefaultView property. No server-side trip necessary.
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.

Unless you want to actually change the record, this is a display issue
and not a data issue. Tackle it however you see best.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
D

Dmitri Shvetsov

Hi Frank,

Where should I do that? In a datagrid? I don't use any datagrid here, there
are many relations and I need to show a more "user-friendly" interface.

Dmitri
 
F

Frank Oquendo

Dmitri said:
Where should I do that? In a datagrid?

No. Your DataSet has a collection of DataTables. Each of these
DataTables has a DefaultView property which is actually a DataView
object. These are very handy for sorting and filtering DataTables.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
D

Dmitri Shvetsov

Frank,

I think that you're right, but I can substitute the values in the required
column very easy. The question is how to organize an interface for a user to
manage this sorting easier. Like Drag an item, move to a required position
and then fix there. I even can't imaging myself where is better to do that?
In a ListView? Each record has many fields. I can show only few as a string,
but then I need to D-n-D them using a mouse. That's a problem.

Dmitri
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top