IT Community - Software Programming, Web Development and Technical Support

Convert Dataview to Datatable

This is a discussion on Convert Dataview to Datatable within the C# Programming forums, part of the Software Development category; Hi I have used filter and sort option in a datatable's default view. I need the new data (with ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-23-2008, 02:34 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Question Convert Dataview to Datatable

Hi

I have used filter and sort option in a datatable's default view. I need the new data (with sorting and filtering) from the defaultview. I have tried the below code(bold letters). but its not working. I got the old data only.

Datatable dt,dtnew;
DataView dv
daAdapter.Fill(dt)
dt.DefaultView.Sort = "F1 ASC,F2 ASC,F3 ASC";
dt.DefaultView.RowFilter = "F1 <> 'Country'";


dtnew = dt.DefaultView.Table;


Thanks in advance
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-23-2008, 02:36 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: Convert Dataview to Datatable

Hi

Try this

dtnew = dt.DefaultView.ToTable();
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-23-2008, 02:51 AM
$enthil $enthil is offline
D-Web Sr.Programmer
 
Join Date: Apr 2007
Posts: 162
$enthil is on a distinguished road
Smile Re: Convert Dataview to Datatable

Even i have tried a lot by writing a seperate function to convert view to table, but it really helps.. thanks....
__________________
$enthil
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort Datatable oxygen C# Programming 2 04-22-2008 10:25 PM
How to get distinct records from datatable oxygen C# Programming 1 03-05-2008 02:47 AM
How will get distinct values from datatable Mramesh C# Programming 5 02-14-2008 08:51 PM
How to remove empty or null rows from a dataview it.wily C# Programming 2 02-10-2008 07:34 AM
Cannot implicitly convert type 'void' to 'System.Data.DataTable' oxygen C# Programming 7 07-30-2007 10:08 AM


All times are GMT -7. The time now is 10:55 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0