gsc123
Programmer
- Jan 24, 2008
- 197
Could this code be better as a query rather than wrapping a execute in this loop?
first query is
SELECT products.Description, products.Price, products.ImageUrl, products.idproduct, products.endDate, suppliers.idsupplier, suppliers.supplierName FROM suppliers INNER JOIN products ON suppliers.idsupplier = products.idsupplier WHERE idcategory=21 and ListHidden = false
do while not rsTempProducts.eof and count < rsTempProducts.pageSize
pidProduct = rsTempProducts("idproduct")
pDescription = rsTempProducts("description")
'pPrice = rsTempProducts("price")
sql = "SELECT Min(bidAmount) AS price FROM BidHistory WHERE (((BidHistory.bidAmount) In (SELECT Min(BidAmount) FROM BidHistory WHERE BidAmount<10009999 and idproduct = "&pidProduct&")))"
set rsMin = conntemp.execute(sql)
pPrice = rsMin("price")
pImageURL = rsTempProducts("imageURL")
pEndDate = rsTempProducts("endDate")
pSupplierName = rsTempProducts("supplierName")
pIdSupplier = rsTempProducts("idsupplier")
%><!--#include file="itemdetailsm.asp"--><%
count = count + 1
rsTempProducts.MoveNext
loop
first query is
SELECT products.Description, products.Price, products.ImageUrl, products.idproduct, products.endDate, suppliers.idsupplier, suppliers.supplierName FROM suppliers INNER JOIN products ON suppliers.idsupplier = products.idsupplier WHERE idcategory=21 and ListHidden = false
do while not rsTempProducts.eof and count < rsTempProducts.pageSize
pidProduct = rsTempProducts("idproduct")
pDescription = rsTempProducts("description")
'pPrice = rsTempProducts("price")
sql = "SELECT Min(bidAmount) AS price FROM BidHistory WHERE (((BidHistory.bidAmount) In (SELECT Min(BidAmount) FROM BidHistory WHERE BidAmount<10009999 and idproduct = "&pidProduct&")))"
set rsMin = conntemp.execute(sql)
pPrice = rsMin("price")
pImageURL = rsTempProducts("imageURL")
pEndDate = rsTempProducts("endDate")
pSupplierName = rsTempProducts("supplierName")
pIdSupplier = rsTempProducts("idsupplier")
%><!--#include file="itemdetailsm.asp"--><%
count = count + 1
rsTempProducts.MoveNext
loop