Re: How to resort records in a dataSet?
- From: "William Vaughn" <billvaNoSPAM@xxxxxxxxx>
- Date: Sat, 3 Nov 2007 11:38:19 -0700
The DataView is the correct path. Let's see your code.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Andrew" <Andrew@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:A315398B-FE8E-41C0-943B-01608EA9F883@xxxxxxxxxxxxxxxx
Hello, friends,
We have an app in c#.net 2003. There is a dataSet. Its data are populated to
a customized list in a loop (NO data binding, now and future). We need to
modify it so that it can be sorted based on user's selections.
I tried the follows by using DataView, but no luck: It still keeps the
original order.
Any ideas? Any other methods that we can resort records in a dataSet? Thanks !
-----------------------
DataView mDataView = new DataView();
mDataView = mDataSet.Tables[0].DefaultView;
mDataView.Sort = "--user's selections--";
mDataSet.Tables.Clear();
mDataSet = null;
DataSet mDataSet2 = new DataSet();
mDataSet2.Tables.Add(mDataView.Table);
foreach (DataRow dr in mDataSet2.Tables[0].Rows)
{
//check the order
}
.
- Follow-Ups:
- Re: How to resort records in a dataSet?
- From: William \(Bill\) Vaughn
- Re: How to resort records in a dataSet?
- Prev by Date: Re: Creating a new Access database file (.mdb) in .NET/C#
- Next by Date: BindingSource.EndEdit and Position
- Previous by thread: Re: Connections String Questions
- Next by thread: Re: How to resort records in a dataSet?
- Index(es):
Relevant Pages
|