·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 制作我们自己的EBAY(拍卖系统)(5)

制作我们自己的EBAY(拍卖系统)(5)

类别: ASP教程  评论数:0 总得分:0
This is the complex part - you must make sure everyone\'s bids are correct, update those that have proxy bids, reallocate lots to winners, notify buyers who have been outbid, and perform some upkeep.

First let\'s look at the code to add a bid.



Function DoBid(ItemID, BidderID, Price, optional MaxPrice, optional MaxItems)


\'Set variables and create objects
strConnectionString = "DSN=MyAuction;UID=username;PWD=password;Database=MyAuctionDB"
set rst = Server.CreateObject("ADODB.Recordset")


\'Check to see if a bid already exists for this buyer and auction
strSQL = "SELECT BID FROM tblAuctionBids WHERE IID = " & ItemID & " AND " & _
"UID = " & BidderID
rst.open strSQL, strConnectionString


if rst.eof then \'A bid does not exist
rst.close
\'Insert info into table
strSQL = "INSERT INTO tblAuctionBids (IID, UID, WinPrice, MaxBid, " & _
"BidItems, WinItems, Time VALUES (" & ItemID & ", " & BidderID & _
", \'" & Price & "\', \'" & MaxPrice & "\', " & MaxItems & _
", 0, \'" & Now() & "\')"
\'Default WinItems to 0 for now


else \'A bid does exist
rst.close
\'Update info in table
strSQL = "UPDATE tblAuctionBids SET WinPrice = \'" & Price & _
"\' WHERE IID = " & ItemID & " AND UID = " & BidderID
end if


rst.open strSQL, strConnectionString


\'\'Fix bidding information
call ResolveBids(ItemID)


End Function



NOTE: This code above is developed for Visual Basic, and the keyword "optional" in the function opener is not supported in VBScript. In an ASP then, simply leave out the keyword "optional" here, and when you call the function, pass in an empty string, i.e.:

call DoBid(ItemId, BidderID, Price, "", "")

This function basically takes some info, and either inserts it or updates it in the Bids table - fairly simple stuff. The function ResolveBids however is where all the good stuff happens.
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1