Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 4246 | Replies: 88 | Solved
![]() |
•
•
Join Date: Feb 2008
Posts: 135
Reputation:
Rep Power: 1
Solved Threads: 3
OKIDOKI
ATTACHMENT
table_1
This is my code
Only one middlecat i viewed under the first topcat and the rest is empty
table_2
This is your code
The middlecat (Bildelar & Biltillbehör) is repeated out of bound into next topcategory cell.
The first one is correct. The number of repeated middlecategory under this specific topcategory is also correct, but only the first is showed up.
ATTACHMENT
table_1
This is my code
Only one middlecat i viewed under the first topcat and the rest is empty
table_2
This is your code
The middlecat (Bildelar & Biltillbehör) is repeated out of bound into next topcategory cell.
The first one is correct. The number of repeated middlecategory under this specific topcategory is also correct, but only the first is showed up.
•
•
Join Date: Feb 2008
Posts: 135
Reputation:
Rep Power: 1
Solved Threads: 3
Attachment 5099Here is another approach
I have used RS.Getrows instead and put everything into an array
CHECK the attachment,
As you can see all of the topcategeries and middlecategories is in their cells properly.
The problem with this code is another, I cant break it into 3 columns.
SQL = "SELECT DISTINCT TC.topcategory,MC.middlecategory "&_
"FROM tbtopcategory TC,tbmiddlecategory MC,tbconnectcategory CC "&_
"WHERE TC.topcategoryID = CC.topcategorylink "&_
"AND MC.tbmiddlecategoryID = CC.middlecategorylink " &_
"ORDER BY TC.topcategory ASC, MC.middlecategory ASC "
RS.Open SQL,Conn
arrDB = RS.GetRows()
iStart = LBound(arrDB,1)
iStop = UBound (arrDB,2)
Response.Write("<table width='570' border='1'>")
For i = iStart to iStop
TopCat = arrDB(0, i)
If LastTopCat <> TopCat Then
Response.Write("</td><td width='190'>")
TCat = arrDB(0, i) & "<br>"
Response.write TCat
LastTopCat = TopCat
End If
Response.write arrDB(1, i) & " , "
Next
Response.Write("</tr>")
Response.Write("</table>")
RS.Close
Conn.Close
I have used RS.Getrows instead and put everything into an array
CHECK the attachment,
As you can see all of the topcategeries and middlecategories is in their cells properly.
The problem with this code is another, I cant break it into 3 columns.
SQL = "SELECT DISTINCT TC.topcategory,MC.middlecategory "&_
"FROM tbtopcategory TC,tbmiddlecategory MC,tbconnectcategory CC "&_
"WHERE TC.topcategoryID = CC.topcategorylink "&_
"AND MC.tbmiddlecategoryID = CC.middlecategorylink " &_
"ORDER BY TC.topcategory ASC, MC.middlecategory ASC "
RS.Open SQL,Conn
arrDB = RS.GetRows()
iStart = LBound(arrDB,1)
iStop = UBound (arrDB,2)
Response.Write("<table width='570' border='1'>")
For i = iStart to iStop
TopCat = arrDB(0, i)
If LastTopCat <> TopCat Then
Response.Write("</td><td width='190'>")
TCat = arrDB(0, i) & "<br>"
Response.write TCat
LastTopCat = TopCat
End If
Response.write arrDB(1, i) & " , "
Next
Response.Write("</tr>")
Response.Write("</table>")
RS.Close
Conn.Close
Last edited by TobbeK : Feb 15th, 2008 at 1:29 pm.
•
•
Join Date: Sep 2007
Posts: 1,058
Reputation:
Rep Power: 4
Solved Threads: 62
Ok, try this:
What was failing in the previous code was the Do While TopCat = LastTopCat
It was only seeing that hit once.
EDITED: Had to move the i = i + 1 down
If Not RS.EOF Then
Response.Write("<table width=""570"" border=""1"">")
Do While Not RS.EOF
Response.Write("<tr>")
i = 0
TopCat = RS("topcategory")
MiddleCat = RS("middlecategory")
Do While i <> 3
If Not RS.EOF Then
If Not LastTopCat = TopCat Then
Response.Write ("<td width=""190"">")
Response.Write(RS("topcategory") & "<br />")
Response.Write("-----------------------------")
LastTopCat = TopCat
End If
Response.Write("<br />" & MiddleCat)
RS.MoveNext
If Not RS.EOF Then
TopCat = RS("topcategory")
MiddleCat = RS("middlecategory")
End If
If Not LastTopCat = TopCat or RS.EOF Then
Response.Write("</td>")
i = i + 1
End If
Else
Response.Write("<td width=""190""></td>")
i = i + 1
End If
Loop
Response.Write("</tr>")
Loop
Response.Write("</table>")
End IfIt was only seeing that hit once.
EDITED: Had to move the i = i + 1 down
Last edited by SheSaidImaPregy : Feb 15th, 2008 at 1:51 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode