Discussion Locked

Redirect with VBScript

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a need to test my Database for more than one item, if so I go to one page else the second page. I have inclued the code below:
<% @language="vbscript" %>

<%
Dim Recordset1__MM_ColParman
Recordset1__MM_ColParman = "1"
If (Request.QueryString("Grouping") <> "") Then
Recordset1__MM_ColParman = Request.QueryString("Grouping")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_ABBA_STRING
Recordset1.Source = "SELECT Count(Distinct subgrpID) FROM tblsubgrouping WHERE grpID = '" + Replace(Recordset1__MM_ColParman, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
If (Recordset1.Fields.Item("Count(Distinct subgrpID)").Value) > 1 Then
Location.href = "http://www.Ambassadors.org"
End If
If (Recordset1.Fields.Item("Count(DistinctsubgrpID)").Value) = 1 Then
Location.href = "http://www.Compulink.net"
End If
%>

<%
Recordset1.Close()
%>

Thanks for your help....

gwhiting@compulink.net

1 reply

by jay eckles

Instead of Location.href in a document with HTML tags, remove the HTML tags and use Response.Redirect -

<%
If (Recordset1.Fields.Item("Count(Distinct subgrpID)").Value) > 1 Then
Response.redirect( "http://www.Ambassadors.org" )
End If
If (Recordset1.Fields.Item("Count(Distinct subgrpID)").Value) = 1 Then
Response.redirect( "http://www.Compulink.net" )
End If
%>

<%
Recordset1.Close()
%>

This discussion is closed to new replies.