2013-12-09 51 views
0

相同類別名稱在網格中多次顯示。同一類別名稱在網格中多次顯示

我的查詢是這樣的:

<% SQLGetThumbList13="select CategoryID,CategoryName,ActiveFrom,ActiveUntil,HideCategory from categories where CategoryID="& RSGetThumbList12("CategoryID") 
       set RSGetThumbList13= server.createobject("ADODB.Recordset") 
RSGetThumbList13.CursorLocation=3 
       RSGetThumbList13.open SQLGetThumbList13,UserConn, 3, 3, 1 
         ThumbCount13 = RSGetThumbList13.RecordCount 
%> 

我甚而不需要類別電網正確顯示,所有我需要的是顯示所有類別名稱爲BOOKID 但由於某些原因,它只是顯示一些記錄

<% 
'SQLGetThumbList12="select * from BooksAndCategories where BookID="& RSGetThumbList10("BookID") 
SQLGetThumbList12="select * from BooksAndCategories as BooksCat inner join Categories as Cat " & _ 
              "ON BooksCat.CategoryID=Cat.CategoryID where BooksCat.BookID=" & RSGetThumbList10("BookID") 
set RSGetThumbList12= server.createobject("ADODB.Recordset") 
RSGetThumbList12.CursorLocation=3 
RSGetThumbList12.open SQLGetThumbList12,UserConn, 3, 3, 1 
ThumbCount12 = RSGetThumbList12.RecordCount 
%> 

我的VB代碼

dim strVal1 
strVal1= request("str") 
if(strVal1="unsold")then 
SQLGetThumbList10="select * from Books where Sold=0;" 
else 
SQLGetThumbList10= "SELECT * FROM Books;" 
end if 
set RSGetThumbList10= server.createobject("ADODB.Recordset") 
RSGetThumbList10.CursorLocation=3 
RSGetThumbList10.open SQLGetThumbList10,UserConn, 3, 3, 1 
ThumbCount10 = RSGetThumbList10.RecordCount 
+0

'經典ASP'或'ASP.NET'? – christiandev

+0

我正在使用經典ASP –

+0

這些代碼塊中的哪一個會給出問題? – christiandev

回答

0

將查詢更改爲類似於

"SELECT DISTINCT CategoryName FROM categories WHERE CategoryID=" & SGetThumbList12("CategoryID") 
相關問題