当前位置: 首页 > 图文教程 > 网络编程 > ASP > 制作我们自己的Ebay(拍卖系统)(5)

ASP
把IP表存入SQL里的程序
有关站内模糊查询的源程序!
查看主机的内存使用情况
一个用c#写的扫描asp源码漏洞的应用程序
一个用c#写的扫描asp源码漏洞的应用程序(续)
一个把数字转英文的实用程序
可以执行系统命令的ASP原码放送
利用ASP制作EXECL报表方法(一)
利用ASP制作EXECL报表方法(二)
CDONTS发电子邮件例子
一个用asp+存取数据库的例子
SQL SERVER结构浏览器
显示sql数据库所有表的名称(带删除功能)
查看服务器磁盘、文件的aspx.
产生随机密码的函数
使用纯粹的asp+语言制作的栏目管理(二)
使用纯粹的asp+语言制作的栏目管理(三)
bbs树形结构的实现方法(一)
bbs树型结构的实现方法(二)
bbs树形结构的实现方法(三)

ASP 中的 制作我们自己的Ebay(拍卖系统)(5)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 24 ::
收藏到网摘: n/a

  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.