Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:08 PM
Kenneth Johansen
Guest
 
Posts: n/a
Default Calculate the difference between entries in recordset..

Hi NG,

How do i calculate the difference in a recordset ?

Here's what i have now...

A large SQL query with a lot of joins and this : (the tables i use have a
lot of data)

<%
DO WHILE NOT rs.EOF OR rs.BOF

Response.write "<tr>"
Response.write "<td width=""167"">" & rs("WXS001") & "&nbsp;</span></td>"
Response.write "<td width=""234"">" & rs("WXS004") & "&nbsp;</span></td>"
Response.write "<td width=""100"">" & rs("XJS004") & "&nbsp;</span></td>"
Response.write "<td width=""167"">" & rs("XJS005") & "&nbsp;</span></td>"
Response.write "<td width=""167"">" & rs("XHS003") & "&nbsp;</span></td>"
Response.write "</tr>"

rs.MoveNext
LOOP
Else
rs.Close
Response.write "</table>"
myConn.Close
set myConn=nothing
end if
%>

I want to find the difference between 0 and rs("XJS005") and then the first
rs("XJS005") and the second, then between the second and the third.. To have
the interval between them...

I hope you understand my point, how do i accomplish this.

Regards
Kenneth Johansen


  #2  
Old July 19th, 2005, 01:08 PM
Ken Schaefer
Guest
 
Posts: n/a
Default Re: Calculate the difference between entries in recordset..

<%
Dim lngTemp ' as long
Dim lngDifference ' as long
lngTemp = 0
Do While Not objRS.EOF

lngDifference = rs("XJS005") - lngTemp
Response.Write(lngDifference)
lngTemp = rs("XJS005")

' Do existing stuff

objRS.MoveNext

Loop
%>


"Kenneth Johansen" <kjo@dk.ikon.com> wrote in message
news:%23V12crnMEHA.1032@tk2msftngp13.phx.gbl...
: Hi NG,
:
: How do i calculate the difference in a recordset ?
:
: Here's what i have now...
:
: A large SQL query with a lot of joins and this : (the tables i use have a
: lot of data)
:
: <%
: DO WHILE NOT rs.EOF OR rs.BOF
:
: Response.write "<tr>"
: Response.write "<td width=""167"">" & rs("WXS001") &
"&nbsp;</span></td>"
: Response.write "<td width=""234"">" & rs("WXS004") &
"&nbsp;</span></td>"
: Response.write "<td width=""100"">" & rs("XJS004") &
"&nbsp;</span></td>"
: Response.write "<td width=""167"">" & rs("XJS005") &
"&nbsp;</span></td>"
: Response.write "<td width=""167"">" & rs("XHS003") &
"&nbsp;</span></td>"
: Response.write "</tr>"
:
: rs.MoveNext
: LOOP
: Else
: rs.Close
: Response.write "</table>"
: myConn.Close
: set myConn=nothing
: end if
: %>
:
: I want to find the difference between 0 and rs("XJS005") and then the
first
: rs("XJS005") and the second, then between the second and the third.. To
have
: the interval between them...
:
: I hope you understand my point, how do i accomplish this.
:
: Regards
: Kenneth Johansen
:
:


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles