469,325 Members | 1,596 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,325 developers. It's quick & easy.

ASP help - sorting db columns

10
Hello Friends,
I need help in achieving the desired output
I am stuck doing a program in ASP

I have got a table in SQL that with three columns
Amount,
Reference and
Deposit_Date
and has the following records.

Amount Reference Deposit_Date

7.00 declined 2007/06/02
62.00 released 2007/06/02
32.00 Preauth 2007/06/02
56.00 declined 2007/06/04
45.00 released 2007/06/04
13.00 declined 2007/06/05
19.00 PreAuth 2007/06/05
2.00 declined 2007/06/12
6.00 declined 2007/06/13
39.00 released 2007/06/13
4.00 declined 2007/06/14
25.00 released 2007/06/14

I want to be able to display in these records in the ASP the released amount and the declined amount

against each date.

for example
on 2nd June 2007 there is declined amount and released amount.
which should be displayed (OUTPUT) AS

Date Released Declined PreAuth
2007/06/02 62.00 7.00 32.00
2007/06/04 45.00 56.00 0.00
2007/06/05 19.00 0.00 13.00
Expand|Select|Wrap|Line Numbers
  1. <table>
  2. <tr>
  3.  
  4. <td>
  5. Deposit Date
  6. </td>
  7.  
  8. <td>
  9. Released
  10. </td>
  11.  
  12. <td>
  13. PreAuth 
  14. </td>
  15.  
  16. </tr>
  17.  
  18. <%
  19. Dim strReleased
  20. Dim strDeclined
  21. Dim strPreAuth
  22. Dim totRel
  23. Dim totDec
  24. Dim totPre
  25.  
  26. totRel = 0
  27. totDec = 0
  28. totPre = 0
  29.  
  30. strReleased = "Released"
  31. strDeclined = "Declined"
  32. strPreAuth  = "PreAuth"
  33.  
  34. While not rs.eof
  35. %>
  36. <tr>
  37. <td><%=rs("deposit_date")%></td>
  38. <td><%
  39. If lcase(trim(rs("reference"))) = lcase(trim(strReleased)) Then
  40.     totRel = totRel + rs("Amount")
  41. Else
  42.     Response.write "0"
  43. End If 
  44.  
  45. %></td>
  46.  
  47. <td><%
  48. If lcase(trim(rs("reference"))) = lcase(trim(strDeclined)) Then
  49.     totDec = totDec + rs("Amount")
  50. Else
  51.     Response.write "0"
  52. End If 
  53.  
  54. %></td>
  55.  
  56. <td><%
  57. If lcase(trim(rs("reference"))) = lcase(trim(strPreAuth)) Then
  58.     totPre = totPre + rs("Amount")
  59. Else
  60.     Response.write "0"
  61. End If 
  62.  
  63. %></td>
  64.  
  65.  
  66. </tr>
  67.  
  68. <%
  69. rs.movenext
  70. wend
  71. %>
  72. %>
  73.  
  74. </table>
Aug 4 '07 #1
1 926
shweta123
692 Expert 512MB
Hi,

Are you getting any error in this code ?
Aug 6 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by pmud | last post: by
4 posts views Thread by Gareth Gale | last post: by
11 posts views Thread by rkbnair | last post: by
19 posts views Thread by Owen T. Soroke | last post: by
2 posts views Thread by jediknight | last post: by
3 posts views Thread by =?Utf-8?B?YmJkb2J1ZGR5?= | last post: by
5 posts views Thread by jrod11 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.