您的位置:首页网页设计ASP实例 → 制作我们自己的Ebay拍卖系统5

制作我们自己的Ebay拍卖系统5

时间:2004/11/7 2:52:00来源:本站整理作者:蓝点我要评论(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.








相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 迅雷新手完全入门手册 asp下面javascript上传图片限制格式大小方法告诉大家网页弹出窗口应用总结ASP常见错误类型大全asp常见错误分析和解决办法

人气排行 总是弹出visual studio 实时调试器 三种解决SQLSERVER存储过程及调用详解Asp获取真实IP地址ASP中连接Mssql的几种方法一个简单好用的UBB编辑器(含代码)如何用Split将字符串转换为数组并获取数组下ASP防止表单重复提交的办法告诉你免费的简单聊天室源代码