快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

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

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.
返回类别: 教程
上一教程: 三层动态下拉菜单的例子
下一教程: 多个域名后缀同时查询的域名查询系统

您可以阅读与"制作我们自己的EBAY(拍卖系统)(5)"相关的教程:
· 制作我们自己的EBAY(拍卖系统)(1)
· 制作我们自己的EBAY(拍卖系统)(9)
· 制作我们自己的EBAY(拍卖系统)(6)
· 制作我们自己的EBAY(拍卖系统)(7)
· 制作我们自己的EBAY(拍卖系统)(3)
    微笑服务 优质保证 索取样品