<br>
<table BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="390" height="63"><br>
<tr><br>
<td height="24"><big><font face="Verdana"><big><strong>Post A Match</strong></big></font></big></td><br>
</tr><br>
</table><BR><br>
<div align="center"><center><p> </p><br>
</center></div><blockquote><br>
<div align="left"><table><br>
<tr><br>
<td ALIGN="right"><strong>User name:</strong></td><br>
<td><input TYPE="TEXT" NAME="YourName" SIZE="25"> </td><br>
</tr><br>
<tr><br>
<td ALIGN="right"><strong>Opponent's name:</strong></td><br>
<td><input TYPE="TEXT" NAME="OpponentName" SIZE="25"> </td><br>
</tr><br>
<tr><br>
<td ALIGN="right"><strong>Games Scores Results:</strong></td><br>
<td>Your Score<strong> <select name="YourScore" size="1"><br>
<option value="12">12</option><br>
<option value="13">13</option><br>
<option value="14">14</option><br>
<option value="15">15</option><br>
</select> </strong>Opp's Score<strong> <select name="OpponentScore" size="1"><br>
<option value="9">9</option><br>
<option value="10">10</option><br>
<option value="11">11</option><br>
</select></strong></td><br>
</tr><br>
</table><br>
<p><input type="Submit" value="Submit Results" name="btnSubmit"> </p><br>
</form><br>
</body><br>
</html></p>
<h3>Page 2--The Process Form</h3>
<p><% @Language="VbScript" %><br>
<% <br>
<br>
<b>'Declare all local variables</b><br>
dim conn<br>
dim strconn<br>
dim Gamers<br>
dim strsql<br>
dim strID<br>
<br>
<b>'Sets the DSN-less connection string to a local variable</b><br>
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("MultiTable.mdb")<br>
<br>
<b>'Opens a connection object</b><br>
set conn = server.createobject("adodb.connection")<br>
conn.open strconn<br>
<br>
<b>'Records when the game was played table</b><br>
set GameRS = Server.Createobject("adodb.recordset")<br>
GameRS.open "tblWhenPlayed", conn, 3, 3<br>
GameRS.addnew <br>
GameRS("WinnersName") = request.form("YourName")<br>
GameRS("LosersName") = request.form("OpponentName")<br>
GameRS("DatePlayed") = Date()<br>
GameRS.update<br>
GameRS.movelast<br>
<br>
<b>'Get the Game ID that is created when the record was created</b><br>
strID = GameRS("GameID")<br>
GameRS.Close<br>
set GameRS = nothing<br>
<br>
<b>'Records Winner's into the Losers table</b><br>
strSQL = "INSERT INTO tblWinners(GameID, ZoneName, NumOfPoints)"<br>
strSQL = strSQL & " SELECT "<br>
strSQL = strSQL & strID & " as text1," <br>
strSQL = strSQL & "'" & request("YourName") & "' as text2,"<br>
strSQL = strSQL & request("YourScore") & " as text3"<br>
conn.execute(strsql)<br>
<br>
<b>'Records Losers Info into the Losers table</b><br>
strSQL = "INSERT INTO tblLosers(GameID, ZoneName, NumOfPoints)"<br>
strSQL = strSQL & " SELECT "<br>
strSQL = strSQL & strID & " as text1," <br>
strSQL = strSQL & "'" & request("OpponentName") & "' as text2,"<br>
strSQL = strSQL & request("OpponentScore") & " as text3"<br>
conn.execute(strsql)<br>
<br>
conn.close<br>
set conn = nothing<br>
<br>
%><br>
</p>
<p><html><br>
<head><br>
<title>Post Score Summary</title><br>
</head><br>
<body><br>
<h1>Your Record has been recorded</h1><br>
<h3>Here is your Unique ID:<% = strID %></h3><br>
<p>This demo has just inserted data into Three different tables</p><br>
</body><br>
</html><br>
</p>
blog comments powered by