Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 27th, 2007, 02:28 PM
Registered User
Join Date: Apr 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rearrange the column order in a datatable/dataset


i am using VS 2005. In my web application i populated datatable from a dataset. I removed somw unwanted columns using Datatable's Remove() method.

Now I wanted to arrange the order of the columns in my datatable. i.e. my col1 should be col1, col5 should be col2 and col2 should be col3,....so on. Please help me out for doing this.

Thanks in advance..

  #2 (permalink)  
Old April 29th, 2007, 08:12 PM
Authorized User
Join Date: Mar 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts

How about running a select query with desired order of columns against the current dataset or datatable, pumping the results in to a new datatable and discard the existing one. This is a top of mind solution, let me know if it doesn't work or if its not a good solution.


  #3 (permalink)  
Old May 3rd, 2007, 08:46 AM
Authorized User
Join Date: Dec 2004
Location: Swindon, Wilts, United Kingdom.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DZukiewicz

What is your intent of shuffling around the columns?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rearrange the column order in a datatable/dataset kiran_q8 ASP.NET 2.0 Basics 6 July 3rd, 2007 12:12 PM
Creating DataSet/DataTable from XML hhmoeller XML 4 March 22nd, 2006 10:41 AM
DataTable belongs to another DataSet bmains ADO.NET 2 December 20th, 2005 12:24 AM
For Loop problem with DataSet\DataTable musa BOOK: ASP.NET Website Programming Problem-Design-Solution 2 December 25th, 2003 03:11 AM
For Loop problem with DataSet\DataTable musa BOOK: Professional C#, 2nd and 3rd Editions 1 December 24th, 2003 09:46 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.