当前位置: 移动技术网 > IT编程>开发语言>.net > 制作我们自己的Ebay(拍卖系统)(5)

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

2019年01月15日  | 移动技术网IT编程  | 我要评论

马良神笔,金牌王妃139,搜神记 容祖儿

this is the complex part - you must make sure everyones bids are correct, update those that have proxy bids, reallocate lots to winners, notify buyers who have been outbid, and perform some upkeep.

first lets 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.



如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网