I've generated a dynamic dropdown populated from my database on a web form which is working fine. The problem is that what is being entered into the database is the LeagueID of the first LeagueID written to the database by another user, (ie: first LeagueID record was 6 and no matter which league is selected from the dropdown, 6 is written to the database). When I print the SQL, all of the other field info is correct. Any ideas?
When I print the SQL all of the information is correct, with the exception of the LeagueID.
'declare your variables
Your_UserName = ("UserName")
Your_LeagueName = ("LeagueName")
Your_Week = ("Week")
Your_LaneNumber = ("LaneNumber")
Your_Game1 = ("Game1")
Your_Game2 = ("Game2")
Your_Game3 = ("Game3")
Dim sConnString, connection, sSQL
'Receiving values from Form, assign the values entered to variables
Your_LeagueID = Request.Form("LeagueID")
Your_Week = Request.Form("Week")
Your_LaneNumber = Request.Form("LaneNumber")
Your_Game1 = Request.Form("Game1")
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("../db/BBAMstats.mdb")
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
'declare SQL statement that will query the database
sqlInsert = "SELECT Users.UserID, BSA_Leagues.LeagueID FROM Users, BSA_Leagues WHERE Cust_UserName='"&Request.Cookies("UserName")&"'"
Set rs = server.CreateObject("Adodb.Recordset")
sSQL = "INSERT INTO BSA_STATS (UserID, LeagueID, Week, LaneNumber, Game1, Game2, Game3) values ("& your_userID &"," & _
Your_LeagueID & "," & Your_Week & "," & Your_LaneNumber & "," & Your_Game1 & "," & Your_Game2 & "," & Your_Game3 & ")"
'define the connection string, specify database
'driver and the location of database
'execute the SQL
response.write "Your scores have been successfully recorded."
'Done. Close the connection object
Set connection = Nothing
Any help would be greatly appreciated.