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.