I have to do this fairly quick so while Im trying to do it I figured Id post it as well...I need to change the order by clause depending on which column I click to change the "Order By" statement for the applicable column. Im trying to do a Replace, which was my first thought, in the Order By statement. For example
Select * from tableA Order By PermitID asc
When I click on a column I want to change the Order By clause to read
Select * from tableA Order By StartDate desc
All I need to know is how I can replace the Order By with the new Order By in the string in ASP.net code?