我在这里拥有的是一个非常老套的经典 ASP (VBscript) 脚本的一部分,我需要将数据提取出来,以便将其移动到另一个源中。我遇到了麻烦,因为它似乎正在跳过它正在拉出的作品中的第一条记录。它似乎没问题,直到它达到只有一个值的记录,然后它似乎假装它是空的并继续前进。如果它有多个关联的记录,它会呈现它们,跳过第一个,然后继续。
此处的此脚本显示与列表关联的类别。(该部分未显示)
<%
If intCategoryID = "" Then
intCategoryID = request("ID")
End If
'Response.Write("Bus ID for Category: " & intCategoryID)
set rstCategories = nothing
intCountComma = 0
intFiveCat = 0
Set rstCategories = Server.CreateObject( "ADODB.Recordset" )
If blnFr = 1 Then
strSQL = "SELECT ID, Case Name_Displayed_L2 When '' Then Name_Displayed Else Name_Displayed_L2 End As Name_Displayed, Attraction_Sub_Types.FriendlyURL"
Else
strSQL = "SELECT ID, Name_Displayed, Attraction_Sub_Types.FriendlyURL"
End If
strSQL = strSQL & " From Attraction_Sub_Types Inner Join Attractions_Attraction_Sub_Types_Link ON Attractions_Attraction_Sub_Types_Link.Sub_TypeID = Attraction_Sub_Types.ID"
strSQL = strSQL & " Where Attractions_Attraction_Sub_Types_Link.AttractionID = '" & intCategoryID & "'"
set rstCategories = Conn.execute(strSQL)
If Not rstCategories.BOF And Not rstCategories.EOF Then
rstCategories.MoveFirst
'Do While (Not rstCategories.EOF AND intFiveCat <= 5 )
Do While (intFiveCat <= 5 )
intFiveCat = intFiveCat + 1
If Not rstCategories.EOF Then
If intCountComma <> 0 Then
strNameDisplayed = rstCategories("Name_Displayed")
strSQL2 = "SELECT ID, Name_Displayed, Attraction_Types.FriendlyURL"
strSQL2 = strSQL2 & " From Attraction_Types Inner Join Attraction_Types_Sub_Types_Link ON Attraction_Types_Sub_Types_Link.TypeID = Attraction_Types.ID"
strSQL2 = strSQL2 & " Where Attraction_Types_Sub_Types_Link.Sub_TypeID = '" & rstCategories("ID") & "'"
set rstMaincats = Conn.execute(strSQL2)
If Not rstMaincats.EOF Then
strMainName = rstMaincats("Name_Displayed")
Else
strMainName = "unsorted"
End If
Response.Write("<td>")
%>
<%=strMainName%>-><%=strNameDisplayed%>
<% Response.Write("</td>")
Else
intCountComma = intCountComma + 1
End If
rstCategories.MoveNext
'Do While ( intFiveCat <= 5 )
'Response.Write("<td>")
'Response.Write("</td>")
'intFiveCat = intFiveCat + 1
'Loop
Else
%>
<td> </td>
<%
End If
Loop
Else
Do While (intFiveCat <= 4 )
intFiveCat = intFiveCat + 1
%>
<td> </td>
<%
Loop
End If
If rstCategories.State = adStateOpen Then
rstCategories.Close
End If
Set rstCategories = Nothing
%>
这张图片是这篇文章的输出:http: //i.imgur.com/BAwSxWk.jpg你那些显示空白的,应该有 1 个类别而不是显示没有,而其他显示的是第二个类别和向前。
提前致谢。