troubleshooting Question

classic asp recordset

Avatar of Webboy2008
Webboy2008 asked on
JavaScriptASPVB Script
4 Comments1 Solution505 ViewsLast Modified:
Function DestinationList(Destination,DbConnection)

SQL =" SELECT "
SQL = SQL & " f.AddressID, f.Address AS frAddress, f.City AS frCity, f.Zip AS frZip, "
SQL = SQL & " d.Address AS toAddress, d.City AS toCity, d.Zip AS toZip, "
SQL = SQL & " g.VanpoolID, g.MilesToWork, g.PickupAddressID, "
SQL = SQL & " p.EmployerName, p.VanpoolID AS Expr1, "
SQL = SQL & " v.VanNumber "
SQL = SQL & " FROM Vanpool AS p INNER JOIN "
SQL = SQL & " Passenger AS g ON p.VanpoolID = g.VanpoolID INNER JOIN "
SQL = SQL & " Van AS v ON p.VanID = v.VanID INNER JOIN "
SQL = SQL & " Address AS d ON p.DestinationID = d.AddressID INNER JOIN "
SQL = SQL & " Address AS f ON g.PickupAddressID = f.AddressID " 
SQL = SQL & " WHERE (d.City ='" & Destination & "') "
SQL = SQL & " ORDER BY f.AddressID, v.VanNumber " 
 
Set RsDestinationList = Server.CreateObject("ADODB.recordset")
RsDestinationList.open SQL, DbConnection, 3,3
If Not RsDestinationList.Eof Then
    p="<table class=""DestinationListMasterStyle""  cellpadding=""3"" cellspacing=""3"">"
    p=p & "<tr>"
    p=p & "<td><strong>From Address</strong></td>"
    p=p & "<td><strong>From City</strong></td>"
    p=p & "</tr>"
    While Not RsDestinationList.Eof
    FromAddress = Trim(RsDestinationList("frAddress"))
    FromCity = Trim(RsDestinationList("frCity"))
    ToAddress = Trim(RsDestinationList("toAddress")) 
    ToCity = Trim(RsDestinationList("toCity")) 
    ToZip = Trim(RsDestinationList("toZip"))  
    FromAddress = Trim(RsDestinationList("frAddress"))
    FromCity = Trim(RsDestinationList("frCity"))
    FrZip = Trim(RsDestinationList("frZip"))  
    MilesToWork = Trim(RsDestinationList("MilesToWork"))  
    PickupAddressID = Trim(RsDestinationList("PickupAddressID"))  
    VanpoolID = Trim(RsDestinationList("VanpoolID"))  
    VanNumber = Trim(RsDestinationList("VanNumber"))         
    p=p & "<tr>"
    p=p & "<td>" & FromAddress & "</td>"
    p=p & "<td>" & FromCity & "</td>"
    p=p & "</tr>"
    RsDestinationList.MoveNext
    Wend
    p=p & "</table>"
 
else
    p=p & "<table><tr>"
    p=p & "<td>" & GlobalSearchDestinationNullMsg  & "</td>"
    p=p & "</tr></table>"
End If
RsDestinationList.close
Set RsDestinationList = Nothing
Set DbConnection = Nothing




DestinationList=p

End Function
Function DestinationList(Destination,DbConnection)

SQL =" SELECT "
SQL = SQL & " f.AddressID, f.Address AS frAddress, f.City AS frCity, f.Zip AS frZip, "
SQL = SQL & " d.Address AS toAddress, d.City AS toCity, d.Zip AS toZip, "
SQL = SQL & " g.VanpoolID, g.MilesToWork, g.PickupAddressID, "
SQL = SQL & " p.EmployerName, p.VanpoolID AS Expr1, "
SQL = SQL & " v.VanNumber "
SQL = SQL & " FROM Vanpool AS p INNER JOIN "
SQL = SQL & " Passenger AS g ON p.VanpoolID = g.VanpoolID INNER JOIN "
SQL = SQL & " Van AS v ON p.VanID = v.VanID INNER JOIN "
SQL = SQL & " Address AS d ON p.DestinationID = d.AddressID INNER JOIN "
SQL = SQL & " Address AS f ON g.PickupAddressID = f.AddressID " 
SQL = SQL & " WHERE (d.City ='" & Destination & "') "
SQL = SQL & " ORDER BY f.AddressID, v.VanNumber " 
 
Set RsDestinationList = Server.CreateObject("ADODB.recordset")
RsDestinationList.open SQL, DbConnection, 3,3
If Not RsDestinationList.Eof Then
    p="<table class=""DestinationListMasterStyle""  cellpadding=""3"" cellspacing=""3"">"
    p=p & "<tr>"
    p=p & "<td><strong>From Address</strong></td>"
    p=p & "<td><strong>From City</strong></td>"
    p=p & "</tr>"
    While Not RsDestinationList.Eof
    FromAddress = Trim(RsDestinationList("frAddress"))
    FromCity = Trim(RsDestinationList("frCity"))
    ToAddress = Trim(RsDestinationList("toAddress")) 
    ToCity = Trim(RsDestinationList("toCity")) 
    ToZip = Trim(RsDestinationList("toZip"))  
    FromAddress = Trim(RsDestinationList("frAddress"))
    FromCity = Trim(RsDestinationList("frCity"))
    FrZip = Trim(RsDestinationList("frZip"))  
    MilesToWork = Trim(RsDestinationList("MilesToWork"))  
    PickupAddressID = Trim(RsDestinationList("PickupAddressID"))  
    VanpoolID = Trim(RsDestinationList("VanpoolID"))  
    VanNumber = Trim(RsDestinationList("VanNumber"))         
    p=p & "<tr>"
    p=p & "<td>" & FromAddress & "</td>"
    p=p & "<td>" & FromCity & "</td>"
    p=p & "</tr>"
    RsDestinationList.MoveNext
    Wend
    p=p & "</table>"
 
else
    p=p & "<table><tr>"
    p=p & "<td>" & GlobalSearchDestinationNullMsg  & "</td>"
    p=p & "</tr></table>"
End If
RsDestinationList.close
Set RsDestinationList = Nothing
Set DbConnection = Nothing




DestinationList=p

End Function

Hi. attached classic asp code is working but would like to add two thing.

1. Paging: at the bottom, would like to see something like << 1,2,3,4,5 >>
2. alternative color row: like 1st row is silver, 2nd row is white, 3rd now is silver...

Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros