循环结果几乎是正确的...帮助。 [英] Loop results almost right...help.
问题描述
有人能告诉我这里做错了什么......这种方式有用......但是
没有雪茄!
我想循环扔掉每一个服务号码
进入下一个之前获取所有条目。
看起来像这样(在示例中没有包含所有字段):
5554930631
蜂窝电话费5553452212 11/30/05
2.47
Cellular Roming 9999999999 11 / 29/05
0.69
蜂窝播出时间5553455555 11/12/05
3.45
蜂窝播出时间9006661234 11/17/05
9.99
5556491514
5556493465
5556496458
它第一次投掷时工作,但后来只给我服务
数字。
<! - #include file =" include的.asp" - >
<%
Dim connect,rs,connect2,rs2
Dim sSQL,sSQL2
>
设置connect = Server.CreateObject(" ADODB.Connection")
设置rs = Server.CreateOBject(" ADODB.Recordset")
connect .ConnectionString = _
" Provider = Microsoft.Jet.OLEDB.4.0;" &安培; _
数据来源= &安培; sTelecom
connect.open
设置connect2 = Server.CreateObject(" ADODB.Connection")
设置rs2 =服务器.CreateOBject(" ADODB.Recordset")
connect2.ConnectionString = _
" Provider = Microsoft.Jet.OLEDB.4.0;" &安培; _
数据来源= &安培; sTelecom
connect2.open
%>
<%
sSQL =" SELECT *" &安培; _
" FROM 06_Statements &安培; _
"在哪里[结算日期] =''" &安培; Request.Form(Month)& "" &安培; _
"和[总费用]> 0" &安培; _
"和描述LIKE''%Cellular%''"
set rs = Connect.Execute(sSQL)
sSQL2 =" SELECT DISTINCT [Service Number ]" &安培; _
" FROM 06_Statements &安培; _
"在哪里[结算日期] =''" &安培; Request.Form(Month)& "" &安培; _
"和[总费用]> 0" &安培; _
"和说明LIKE''%Cellular%''" &安培; _
" ORDER BY [服务号码]"
设置rs2 = Connect2.Execute(sSQL2)
%>
< html>
< head>
< title> Untitled Document< / title>
< meta http-equiv =" Content-Type" content =" text / html;
charset = iso-8859-1">
< / head>
< body>
< table>
< tr>
< td>服务编号< / td>
< td>订阅者< / td>
< td>描述< / td>
< td>到数字< / td>
< td>持续时间< / td>
< td>连接日期< / td>
< td>金额< / td> ;
< / tr>
<%
直到rs2.eof
%>
< tr>
< td><%= rs2("服务编号")%>< / td>
< td>& nbsp;< / td>
< td>& nbsp;< / td>
< td>& nbsp ;< / td>
< td>& nbsp;< / td>
< td>& nbsp;< / td>
< td>& nbsp;< / td>
< / tr>
<%
Dim sBackgroundColor
sBackgro undColor =" #fffffff"
直到rs.eof
如果rs(服务编号)= rs2("服务号码)然后
如果sBackgroundColor =" #ffffff"然后
sBackgroundColor ="#f7f7f7"
Else
sBackgroundColor =" #ffffff"
结束If
%>
< tr bgcolor ="<%= sBackgroundColor%>">
< td><%= rs(" Service Number")%>< / td>
< td><%= rs(" Subscriber User Name")% >< / td>
< td><%= rs(" Description")%>< / td>
< td> <%= rs(&To To Number")%>< / td>
< td align =" center"><%= rs(" Duration") %>< / td>
< td><%= rs(" Connect Date")%>< / td>
< td align =" right"><%= rs(" Total Charge")%>< / td>
< / tr>
<%结束如果
rs.MoveNext
Loop%>
<%
rs2.MoveNext
Loop%>
< / table>
< / b ody>
< / html>
Can someone tell me what I''ve done wrong here...this kinda works...but
no cigar!
I want to loop threw each "Service Number" and get all entries before
going on to the next.
What looks something like this (didn''t include all fields in example):
5554930631
Cellular Toll Charges 5553452212 11/30/05
2.47
Cellular Roming 9999999999 11/29/05
0.69
Cellular Air Time 5553455555 11/12/05
3.45
Cellular Air Time 9006661234 11/17/05
9.99
5556491514
5556493465
5556496458
it works the first time threw but then just gives me the Service
Number.
<!--#include file="include.asp" -->
<%
Dim connect, rs, connect2, rs2
Dim sSQL, sSQL2
Set connect = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateOBject("ADODB.Recordset")
connect.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sTelecom
connect.open
Set connect2 = Server.CreateObject("ADODB.Connection")
Set rs2 = Server.CreateOBject("ADODB.Recordset")
connect2.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sTelecom
connect2.open
%>
<%
sSQL = "SELECT *" & _
" FROM 06_Statements" & _
" WHERE [Billing Date] = ''" & Request.Form("Month") & "''" & _
"And [Total Charge] > 0" & _
" AND Description LIKE''%Cellular%''"
set rs = Connect.Execute(sSQL)
sSQL2 = "SELECT DISTINCT [Service Number]" & _
" FROM 06_Statements" & _
" WHERE [Billing Date] = ''" & Request.Form("Month") & "''" & _
" And [Total Charge] > 0" & _
" AND Description LIKE''%Cellular%''" & _
" ORDER BY [Service Number]"
set rs2 = Connect2.Execute(sSQL2)
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<table>
<tr>
<td>Service Number</td>
<td>Subscriber</td>
<td>Description</td>
<td>To Number</td>
<td>Duration</td>
<td>Connect Date</td>
<td>Amount</td>
</tr>
<%
Do until rs2.eof
%>
<tr>
<td><%=rs2("Service Number")%></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%
Dim sBackgroundColor
sBackgroundColor = "#ffffff"
Do until rs.eof
If rs("Service Number") = rs2("Service Number") Then
If sBackgroundColor = "#ffffff" Then
sBackgroundColor = "#f7f7f7"
Else
sBackgroundColor = "#ffffff"
End If
%>
<tr bgcolor="<%=sBackgroundColor%>">
<td><%=rs("Service Number")%></td>
<td><%=rs("Subscriber User Name")%></td>
<td><%=rs("Description")%></td>
<td><%=rs("To Number")%></td>
<td align="center"><%=rs("Duration")%></td>
<td><%=rs("Connect Date")%></td>
<td align="right"><%=rs("Total Charge")%></td>
</tr>
<% End If
rs.MoveNext
Loop %>
<%
rs2.MoveNext
Loop %>
</table>
</body>
</html>
推荐答案
oops ...这件事切断了我的行..应该看起来像
移动电话收费5553452212 11/30/05 2.47
Cellular Roming 9999999999 11/29/05 0.69
蜂窝播出时间5553455555 11/12/05 3.45
蜂窝播出时间9006661234 11/17/05 9.99
oops...this thing cut off my rows..it should look like
Cellular Toll Charges 5553452212 11/30/05 2.47
Cellular Roming 9999999999 11/29/05 0.69
Cellular Air Time 5553455555 11/12/05 3.45
Cellular Air Time 9006661234 11/17/05 9.99
ey****@ncsa.uiuc.edu 写道:
可以有人告诉我这里我做错了什么......这种方式有用......但是没有雪茄!
我想循环扔掉每一个服务号码。在
进入下一个之前获取所有条目。
看起来像这样的东西(不包括示例中的所有字段):
Can someone tell me what I''ve done wrong here...this kinda works...but
no cigar!
I want to loop threw each "Service Number" and get all entries before
going on to the next.
What looks something like this (didn''t include all fields in example):
Geez,你这样做很难(和错误)。
你需要创建一个连接两个表的SQL语句。
>
哇......这真的没什么用处
Wow...that wasn''t really helpful
这篇关于循环结果几乎是正确的...帮助。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!