Sorting Column - Parameter not staying (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


Grambo58 -> Sorting Column - Parameter not staying (1/16/2008 1:22:47)

I'm using the great tutorial that is being shown all over this website.
http://www.frontpagemagic.com/DRW/Format/DynamicSorting/Index.asp

But when I go to add the value SUM(PlayerStats.Rush_Yards) to the parameter ::SortColumn:: , I don't get any results. When I go back into my query and look at the default settings, I see that the value for my SortColumn has dissapeared. I can't get anything to stay.

Also, when I click on the hyperlinks to sort my columns, I also have more "SUM()" values and it isn't displaying anything.

The tutorial doesn't explain how to do this. Can anyone help?

Here is my query before which works great.
quote:

SELECT PlayerStats.Name, SUM(PlayerStats.Rush_Att) AS Attempts, SUM(PlayerStats.Rush_Yards) AS Yards, ROUND(SUM(PlayerStats.Rush_Yards) / SUM(PlayerStats.Rush_Att),2) AS Average, SUM(PlayerStats.Rush_TD) AS Touchdowns FROM PlayerStats WHERE PlayerStats.Rush_Att > 0 GROUP BY PlayerStats.Name ORDER BY SUM(PlayerStats.Rush_Yards) DESC;


Here is my query after.
quote:

SELECT PlayerStats.Name, SUM(PlayerStats.Rush_Att) AS Attempts, SUM(PlayerStats.Rush_Yards) AS Yards, ROUND(SUM(PlayerStats.Rush_Yards) / SUM(PlayerStats.Rush_Att),2) AS Average, SUM(PlayerStats.Rush_TD) AS Touchdowns FROM PlayerStats WHERE PlayerStats.Rush_Att > 0 GROUP BY PlayerStats.Name ORDER BY ::SortColumn:: DESC;




Spooky -> RE: Sorting Column - Parameter not staying (1/16/2008 13:34:06)

Whenever an extended query is added, you need to also add the new parameter to the hyperlink.
Do you have a non working example we can see?




Grambo58 -> RE: Sorting Column - Parameter not staying (1/16/2008 22:28:55)

Well, here is the working site. I have mixed aspx and asp. I'm in the middle of converting everything to asp since I can get the hyperlinks to work easier.
http://cascadefootball.net/stats/stats_defense.htm
If you click on either pull down menu and go to "Rushing" you will see the pages that I have used your tutorials for. (added hyperlinks) I will go back and create the one I had with sortable columns after I put the childrens to bed.

Okay, here is a link to one that I can't get to work.

http://cascadefootball.net/stats/sort.asp?SortColumn=SUM(PlayerStats.Rush_Att)




Grambo58 -> RE: Sorting Column - Parameter not staying (1/23/2008 13:51:31)

Just wondering if anyone has had a chance to look. I'd really like to get the sort worked out.




Spooky -> RE: Sorting Column - Parameter not staying (1/23/2008 14:19:49)

Im not sure what you are trying to do with that code?
You dont add SUM(PlayerStats.Rush_Att) - you add the actual vlaue you are filtering with

eg :

http://cascadefootball.net/stats/sort.asp?SortColumn=attempts

The DRW query is then based on ::SortColumn::




Grambo58 -> RE: Sorting Column - Parameter not staying (1/23/2008 19:25:32)

aha! I'll try that tonight!




Grambo58 -> RE: Sorting Column - Parameter not staying (1/23/2008 21:52:50)

Well here is the problem I'm running into. In my query I have SUM(PlayerStats.Rush_Yards) as Yards... and then I have ORDER BY SUM(PlayerStats.Rush_Yards) DESC; My query works perfect. If I change it to ORDER BY Yards or ORDER BY [Yards] I don't return any results. This is why I used the Sum in the Query String.

Order By SUM(PlayerStats.Rush_Yards)
http://cascadefootball.net/stats/sort2.asp

Order By Yards
http://cascadefootball.net/stats/sort.asp

***Clarification*** These two pages are not using parameters. Just my SQL statements.




Spooky -> RE: Sorting Column - Parameter not staying (1/24/2008 13:46:29)

How do you sort the columns? the drop down goes to an aspx page?




Grambo58 -> RE: Sorting Column - Parameter not staying (1/25/2008 2:03:47)

Sorry, I got rid of those drop downs. They are only jump menus. They take you to pages that have pre-defined SQL querys. All of my pages have querys that are sorted in the DBW. I don't use any parameters to sort.

My query for Sort.asp that does not work:
quote:

SELECT PlayerStats.Name, SUM(PlayerStats.Rush_Att) AS Carries, SUM(PlayerStats.Rush_Yards) AS Yards, ROUND(SUM(PlayerStats.Rush_Yards) / SUM(PlayerStats.Rush_Att),2) AS Average, SUM(PlayerStats.Rush_TD) AS Touchdowns FROM PlayerStats WHERE PlayerStats.Rush_Att > 0 GROUP BY PlayerStats.Name ORDER BY Yards DESC;


My query for Sort2.asp that does work:
quote:

SELECT PlayerStats.Name, SUM(PlayerStats.Rush_Att) AS Carries, SUM(PlayerStats.Rush_Yards) AS [Yards], ROUND(SUM(PlayerStats.Rush_Yards) / SUM(PlayerStats.Rush_Att),2) AS Average, SUM(PlayerStats.Rush_TD) AS Touchdowns FROM PlayerStats WHERE PlayerStats.Rush_Att > 0 GROUP BY PlayerStats.Name ORDER BY SUM(PlayerStats.Rush_Yards) DESC;



The only thing I change to get it to return the results I need is the "ORDER BY" clause.




Grambo58 -> RE: Sorting Column - Parameter not staying (1/30/2008 23:38:25)

Has anyone had a chance to see what I'm doing wrong?




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125