Make our own ebay (auction system en)-Managing Bids-page 5

Source: Internet
Author: User
Tags insert
This is the complex part-you must make sure everyone's bids are, update correct that those proxy have, bids L OTS to winners, notify buyers who have been, and outbid perform.

The "the" the "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 the 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 ' not ' supported in VBScript. In a ASP then, simply leave out of the keyword "optional" here, and the called the function, pass in a empty string, i.e .:

Call Dobid (ItemId, Bidderid, Price, "", "")

This function basically takes some info, and either inserts it or updates it at Bids simple table-fairly. The function Resolvebids however is where all the good stuff happens.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.