| |
timdehert
Posts: 1
Score: 0
Joined: 4/14/2005
From:
Status: offline
|
I made this script to add data into an MS Access table. It uses a simple loop to present the table on the webpage and to add the repeating rows to the Access-table. The problem I'm having is that I cannot redirect the users to another page when they click the submit-button. This button triggers the sql-statement, and when I add a "response.redirect" to this button, it just jumps to the other page, without executing the sql-statement. So I need to put this outside of the loop, but the problem is that the sql-statement has to be inside. It's contradictory... Can you see what I mean? This is the (reduced) script: <% While ((Repeat1__numRows <> 0) AND (NOT ratees.EOF)) %> <tr> <td class="paragraph"> <div align="center"> <input name="q1_score<%=Repeat1__index%>" type="text" id="q1_score" size="1" maxlength="1"> </div></td> <td class="paragraph"> <div align="center"> <input name="q2_score<%=Repeat1__index%>" type="text" id="q2_score" size="1" maxlength="1"> </div></td> [etc] </tr> <% if(Request("q1_score"&Repeat1__index) <> "") then ins_scores__score1 = Request("q1_score"&Repeat1__index) if(Request("q2_score"&Repeat1__index) <> "") then ins_scores__score2 = Request("q2_score"&Repeat1__index) [etc] If Request("Submit") <> "" Then set ins_scores = Server.CreateObject("ADODB.Command") ins_scores.ActiveConnection = MM_SPAT_STRING ins_scores.CommandText = "INSERT INTO tbl_scores (q1_score, q2_score, ) VALUES (" + Replace(ins_scores__score1, "'", "''") + "," + Replace(ins_scores__score2, "'", "''") + "," + [etc] ins_scores.CommandType = 1 ins_scores.CommandTimeout = 0 ins_scores.Prepared = true ins_scores.Execute() End If Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 ratees.MoveNext() Wend
|
|