查看: 1485|回复: 5
|
版主可以删帖了。
[复制链接]
|
|
我正赶着 assignment, 是有关设立卖书的。
店里有10本书。 好的。 welcome.htm 呢就有 form tag。是 post 去 asp file 的。
问题就是, 要怎样才能正确地把目录放出来。
比如, 有2项 : information systems, finance, accounting 在首页。
第二页, 我要只是显示3本 info sys 的书。 (也就是顾客在第一页点击 information system 项目)
我的 asp 里是 这样的:
<%
Dim connection, query, data, count
' Create an ADODB Connection object to allow connection to a database
Set connection = Server.CreateObject( "ADODB.Connection" )
' Open a connection to the database referenced
' with the System Data Source Name (DSN) of books
Call connection.Open( "IC2A2_05" )
' Create the SQL query and the record set object
query = "SELECT * FROM products where category = Information Systems" (我想问题是这儿, 可是我不会)
Set data = Server.CreateObject( "ADODB.Recordset" )
Set count = Server.CreateObject( "ADODB.Recordset" )
' Execute query against the database
' Record set data is populated with all the records
' that match
Call data.Open( query, connection )
' Count the total number of books in the database
' and save it as a Session variable
Call count.Open( "SELECT COUNT(*) AS C FROM Products", connection)
Session( "TotalNumBooks" ) = CInt(count("C"))
' Declare array to store each book's data
Dim allBookData( 9 )
Redim allBookData( Session( "TotalNumBooks" ))
' Begin a while loop that iterates through each record
' in the record set
While Not data.EOF
Dim oneBooksInformation
oneBooksInformation = data( "productID" ) & "|" & _
data( "title" ) & "|" & _
data( "authors" ) & "|" & _
data( "publishDate" ) & "|" & _
data( "edition" ) & "|" & _
data( "isbn" ) & "|" & _
data( "coverart" ) & "|" & _
data( "description" ) & "|" & _
data( "price" ) & "|" & _
data( "category")
%>
<!-- Create a link to each page that describes -->
<!-- the book -->
<a href = "book1.asp">
<font color = "green" size = "6">
Information Systems: Foundations of e-Business
</font>
</a>
<br>
<!-- Create a link to each page that describes -->
<!-- the book -->
<a href = "book2.asp">
<font color = "green" size = "6">
Information Systems Today
</font>
</a>
<br>
<!-- Create a link to each page that describes -->
<!-- the book -->
<a href = "book3.asp">
<font color = "green" size = "6">
Information Systems: A Management Approach
</font>
</a>
<br>
<!-- Create a link to each page that describes -->
<!-- the book -->
<a href = "book4.asp">
<font color = "green" size = "6">
Fundamentals of Corporate Finance
</font>
</a>
<br>
<%
' Place the current book's data into the array
' allBookData which is used to store each book's
' data. The productID is used for the array's index
allBookData( CInt( data( "productID" ) ) ) = _
oneBooksInformation
Call data.MoveNext() ' Move to the next record
Wend
' Close the record set and data base connection
Call data.Close()
Call connection.Close()
' Create a Session variable for book.asp to
' get its book data
Session( "bookDataArray" ) = allBookData
%>
<br>
</center>
</body>
</html>
<!--
各位救我啊!!!!
[ 本帖最后由 rover 于 27-10-2005 08:12 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 26-10-2005 10:33 PM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 26-10-2005 10:50 PM
|
显示全部楼层
是的。 因为我是初学者。
版主, 你认为这帖有关到 SQL 吗? 如是,请帮我转。 谢谢 |
|
|
|
|
|
|
|

楼主 |
发表于 27-10-2005 01:04 PM
|
显示全部楼层
我有个 drop down list. 当我按了键之后, 要怎样才能让我看到我想要的 ?
query = select * from table where field = 'xxx'z这边要放什么 'xxx' 'xxx' |
|
|
|
|
|
|
|
发表于 27-10-2005 01:31 PM
|
显示全部楼层
原帖由 rover 于 27-10-2005 01:04 PM 发表
我有个 drop down list. 当我按了键之后, 要怎样才能让我看到我想要的 ?
query = select * from table where field = 'xxx'z这边要放什么 'xxx' 'xxx'
用post
把你select的item post 出去
然后用Request.Form把它拿下就可以了。
xxx=request.form("xxx") |
|
|
|
|
|
|
|

楼主 |
发表于 27-10-2005 08:11 PM
|
显示全部楼层
谢谢你们花时间回答。
而我在还没看到回复前已交上作业。 凶多吉少了。
不过还是要感谢你们的回答。
版主可以删帖了。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|