Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


redirect to another page

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,2686
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> redirect to another page
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 redirect to another page - 4/14/2005 1:16:35 AM   
  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
 
 
Post #: 1
 
 Re: redirect to another page - 4/14/2005 3:05:06 AM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear timdehert,
Since ur using ASP/VBscript which is a Micrsoft product so evry thing could be possible, use this way of looping

do until ratees.EOF
if Repeat1__numRows <> 0 then

'Ur code here

end if
loop

Hope this helps



Best Regards

Firas S Assaad

(in reply to timdehert)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> redirect to another page Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts