Maddening problem with asp

Joined
May 25, 2006
Messages
2
Reaction score
0
I am trying to display the addresses of some people by rendering javascript by asp. It is a switch script which drops down content when you click a plus sign. The problem is that i am trying to enclose two while loops but they don't seem to be working. i have created a variable which is very important for the javascript to work. This variable must contain a "q" followed by a number. The thing to keep in mind is that each content to dropdown must contain a different q-number combination. two rows cannot have the same q-number. for example 'q1'...'q2'...'q3' etc.

With the first loop i group the states together and with the second loop i intend to sort the table according to the city based on the specific state. The code is given below. I i keep one loop it works fine but with the second loop it does not. i am unable to figure out what is wrong. it is driving me crazy.

<%
Dim objCommand, objCommand1
' objRS.Open "SELECT State FROM Business_Associates GROUP BY STATE", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
Set objCommand = Server.CreateObject("ADODB.Command")
Set objCommand1 = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConn
objCommand1.ActiveConnection = objConn
objCommand.CommandText = "SELECT State FROM Business_Associates GROUP BY STATE"
objCommand1.CommandText = "SELECT add, add1, city, pin, State, phone, mobile1, mobile2, fax, email1, email2 FROM Business_Associates"
' objCommand.CommandType = adCmdText

Set objRS = objCommand.Execute
Set objRS1 = objCommand1.Execute
Set objCommand = Nothing
Set objCommand1 = Nothing

Dim strQno(2000)
Dim strQno1(100000)
Dim intCounter
Dim intCounter1
intCounter = 1
intCounter1 = 30
Dim i, j

While Not objRS.EOF
strQno(intCounter) = "q" & intCounter
%>
<div><h3 style="vertical-align: text-top"><img src="plus.gif" class="showstate" onclick="expandcontent(this, '<%=strQno(intCounter)%>')" /><%=objRS("State")%></h3></a></div>
<div id="<%=strQno(intCounter)%>" style="display: none">
<%
While Not objRS1.EOF
strQno1(intCounter1) = "q" & intCounter1
%>
<div><h3 style="vertical-align: text-top">
<img src="plus.gif" class="showstate" onclick="expandcontent(this, '<%=strQno1(intCounter1)%>')" /><%=objRS1("city")%></h3></div>
<div id="<%=strQno1(intCounter1)%>" class="switchcontent" style="display: none">
<img src="images/address.png" style="margin-right: 10px; vertical-align: bottom" />
<strong>Address:</strong><br /><br /><%=objRS1("add")%>, <%=objRS1("add1")%>, <%=objRS1("city")%> - <%=objRS1("pin")%>, <%=objRS1("state")%>
<hr /><br /><img src="images/telephone.png" style="margin-right: 10px; vertical-align: bottom" />
<strong>Telephone:</strong><br /><br /> <%=objRS1("phone")%><br><%=objRS1("Mobile1")%><br><%=objRS1("Mobile2")%><hr /><br />
<img src="images/fax.gif" style="margin-right: 10px; vertical-align: bottom" />
<strong>Fax:</strong><br /><br /><%=objRS1("fax")%><hr /><br />
<img src="images/email.png" style="margin-right: 10px; vertical-align: bottom" />
<strong>eMail:</strong><br /><br />
<a href="mailto:<%=objRS1("email1")%>><%=objRS1("email1")%></a><br />
<a href="mailto:<%=objRS1("email2")%>><%=objRS1("email2")%></a><hr /></div>
<%
objRS1.MoveNext
intCounter1 = intCounter1 + 1
Wend
%>
</div>
<%
objRS.MoveNext
intCounter = intCounter + 1

Wend

For i=0 to intCounter
Response.write(strQno(i))&"<br>"
next
For j=0 to intCounter1
Response.write(strQno1(j))&"<br>"
next


objRS.Close
objRS1.Close
objConn.Close
Set objRS = Nothing
Set objRS1 = Nothing
Set objConn = Nothing
%>

Please help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top