Sorting ASP.NET Dataset

  • bannerpad
  • Novice
  • Novice
  • bannerpad
  • Posts: 18

Post 3+ Months Ago

Does anyone know how I can sort data from a dataset without using Dataview?

I want to send my dataset into XML with the dataset bring sorted. I know you can sort the dataset using dataview but is there any way to sort it without using dataview?
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

How about just sorting it in the SQL?

Code: [ Select ]
dim cmd as SqlDataAdapter = new SqlDataAdapter("SELECT * FROM table WHERE something=somethingelse ORDER BY somefield DESC", dbcon)

then you can omit the view.sort call, I think.

I don't really know, to be honest... I've not really tried to output to an XML stream... if you're doing a web service, you can sort on the other end instead, since the XML object will build a recordset on that side from the XML stream (although this only applies if you're controlling both sides...)

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 42 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.