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

2016-01-29 17:20 2 1 收藏

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

【 tulaoshi.com - ASP 】

  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.



 

来源:https://www.tulaoshi.com/n/20160129/1501046.html

延伸阅读
标签: 脱毛
问答 图钉提问: 夏天最好的脱毛方法是什么??哪位达人帮忙解决一下 图老师解答: 病情分析:       您好,最好是采用激光脱毛,激光脱毛方式具有一定的高科技含量和强大的物理学基础,主要原理是应用了一个物理学的概念,即某一颜色的物质,一定对某一特殊波长的光吸收率最强。     &nbs...
标签: windows系统
Win8怎样自己制作系统主题?   Windows 8主题是一组由图片和声音定制而成的桌面元素集合,可以给人们以视听享受。我们可以通过自定义主题的方式来实现你的要求。 右击桌面空白处,选择快捷菜单中的个(图老师整理)性化命令。 在弹出的个性化窗口中,任意选择一组主题。选择之后,下面的桌面背景相应就变成了该主题所使用...
婴儿期心理发育 1、2个月婴儿心理发育     这个时期的孩子与外界接触很少,是以自我为中心地生活着,只关心自己的满足。当他们的生活需求得到满足时,就非常平静,而当饥饿、消化不良或疲劳的刺激时,就会不停地啼哭。孩子的注意力有了一定的发展,发亮的或彩色鲜艳的物体出现在视野内时,他会发出愉...
标签: 美容 美容方法
你是否有过这些苦恼,是否遭遇过这些尴尬,是否无奈?是否无助? 别急,图老师图老师小编虽然不能带你拯救地球,但可以教你如何去拯救自己的肌肤。 在一次匆忙的上眉毛油之后,你突然发现眼睫毛卷在一起了 解决:在化妆清洁器上滴一滴挥发清洁剂,在快干的时候,将睫毛上的粘质擦拭掉(在下睫毛下面放置折叠的纸接掉下的残渣)...
夏天腿肿多喝红豆汤 红豆又称赤豆、赤小豆等,它的药用保健作用自古以来就为医家广泛应用。李时珍称其为“心之谷”;《神农本草论》中认为红豆是食物药;《神农本草经》上则介绍,红豆具有消肿、轻身的功效。 湖北省中医院消化内科叶松教授介绍,红豆性平、味甘酸,有健脾利水、清热除湿、消肿解毒的功效。由于红豆性善下行 ,通利水道,古...

经验教程

552

收藏

12
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部