sort table in webservice

G

Guest

I have a service that calles a SP and I need a column sorted for one
application.. Can I do the sorting via the web service or no? I'm not using
straight SQL for the call, i'm calling a stored procedure
 
B

Ben Lucas

If you're retrieving the results into a DataTable or DataSet, you can use
the DataView object to sort. For example, given a DataTable dt with 2
columns ("ID" and "Column_To_Sort"), the following code could sort it:

DataView dv = new DataView(dt);
dv.Sort = "Column_To_Sort";

Now as you iterate through the rows in the DataView, it will be sorted on
the column "Column_To_Sort".
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top