473,683 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP help - sorting db columns

10 New Member
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 987
shweta123
692 Recognized Expert Contributor
Hi,

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

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

Similar topics

12
2380
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that field... This grid displayes results based on users search.. public static int numberDiv; private void Page_Load(object sender, System.EventArgs e) {
4
2823
by: Gareth Gale | last post by:
I'm trying to implement a way of allowing a user to sort a HTML table via Javascript on the client. I've seen lots of samples where single column sorting (asc or desc) is shown, but I'd like nested sorting i.e. sort by col1 asc, then by col2 desc etc. Can anyone help ?
4
1703
by: Richard | last post by:
When i try sorting in the database, it sorts the numbers: 0 1 102 2 304 305 4 etc....
11
2141
by: rkbnair | last post by:
I have created a datagrid in my aspx with the 'AllowSorting' property to true. When clicking on the column header, the page refreshes. However the sorting is not done. Am I missing anything? I populate the data if !postback.
19
25456
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to sort columns based on the column header the user has clicked in both Ascending and Descending formats.
2
7223
by: jediknight | last post by:
Hi, I have a listview which has columns of text and columns of numerical data. I need to be able to sort these columns into ascending/desending order whenever the user clicks on the column header. The text columns are sorted correctly but the numerical columns seem not to get sorted properly. For example I get the following result when I try to sort a numerical
3
22750
by: =?Utf-8?B?YmJkb2J1ZGR5?= | last post by:
I have a question that maybe somebody can help me out. I have a gridview that is bound to a sqltable, and I have created two template columns. I am having problems getting the sorting to work. I turned on the Allow Sorting property but when I click one of the columns that is bound, it will not sort. Below is the code I am using
1
2173
by: Ahmed Yasser | last post by:
Hi all, i have a problem with the datagridview sorting, the problem is a bit complicated so i hope i can describe in the following steps: 1. i have a datagridview with two columns (LoginName,UserName) 2. the datagridview sorting is set to automatic, so when i click on the column header is sorts well. 3. i put in an event handler for the CellEndEdit Event, so whenever the user of the program changes the content of a cell in the LoginName...
7
20015
Plater
by: Plater | last post by:
I am having trouble determining when my DataGridView object is sorting (based on a column header click). The idea is, in a large table, sorting the columns takes time, so I show a splash screen. When it is done sorting I want the splash screen dissapear. What I had been doing was using the CellClick and Sorted events: private void myDGV_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) {//sorting
5
4939
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums there are, it crashes. There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)? Here is a link: http://www.jaredmoore.com/tablesorter/docs/salestable.html Here is some jquery js that I think...
0
8568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8504
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9042
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8751
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6429
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5789
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2934
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.