制作我们自己的Ebay(拍卖系统)(4)
程序员文章站
2024-01-28 17:27:52
first, well discuss the easy part. youll have to create a few forms - one for the users to register...
first, well discuss the easy part. youll have to create a few forms - one for the users to register (that is, get themselves into our auctionusers table), and one for sellers to post their info. these forms should be easy to create if you know how to handle forms (check out this wdvl article for more information). basically, you should collect all the information from the forms and update the appropriate tables:
set variables and create object
strconnectionstring = "dsn=myauction;uid=username;pwd=password;database=myauctiondb"
set rst = server.createobject("adodb.recordset")
insert info into auction table
strsql = "insert into tblauctions (startdate, enddate, sellerid)
values (" & request.form("startdate") & ", " & request.form("enddate")
& ", " & sellerid & ")"
rst.open strsql, strconnectionstring
get the id of the auction we just entered
strsql = "select max(aid) as aid from tblauctions"
rst.open strsql, strconnectionstring
intaid = rst(0)
rst.close
insert item info
strsql = "insert into tblauctionitems (aid, name, description, " & _
"minprice, increment, available)" & _
"values (" & intaid & ", " & request.form("itemname") & _
", " & request.form("itemdescription") & ", " & _
request.form("minprice") & ", " & request.form("increment")
& _
", " & request.form("available") & ")"
rst.open strsql, strconnectionstring
clean up
set rst = nothing
the bids are a bit harder to manage. lets look at these in more detail.
set variables and create object
strconnectionstring = "dsn=myauction;uid=username;pwd=password;database=myauctiondb"
set rst = server.createobject("adodb.recordset")
insert info into auction table
strsql = "insert into tblauctions (startdate, enddate, sellerid)
values (" & request.form("startdate") & ", " & request.form("enddate")
& ", " & sellerid & ")"
rst.open strsql, strconnectionstring
get the id of the auction we just entered
strsql = "select max(aid) as aid from tblauctions"
rst.open strsql, strconnectionstring
intaid = rst(0)
rst.close
insert item info
strsql = "insert into tblauctionitems (aid, name, description, " & _
"minprice, increment, available)" & _
"values (" & intaid & ", " & request.form("itemname") & _
", " & request.form("itemdescription") & ", " & _
request.form("minprice") & ", " & request.form("increment")
& _
", " & request.form("available") & ")"
rst.open strsql, strconnectionstring
clean up
set rst = nothing
the bids are a bit harder to manage. lets look at these in more detail.