Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why aren't my connections closing ?

Status
Not open for further replies.

welshone

Programmer
Jul 30, 2001
414
0
0
GB
Hello,
Can anybody see what I wrong with this page ?

When I open it it creates a connection, but then I close it in the code, when I click on a building it opens up another page with more details.
however, if I look in my SQL Server connections the first page isn't closing ?


<HTML>

<BODY>
<p align=&quot;center&quot;><b><font size=&quot;+2&quot;> View Buildings </font></b></p>

<%
Dim SearchTextbuilding, MyConnbuilding, SQLbuilding, RSbuilding

Set MyConnbuilding=Server.CreateObject(&quot;ADODB.Connection&quot;)
MyConnbuilding.Open &quot;personnel&quot;,&quot;personnel&quot;,&quot;personnel&quot;

SQLbuilding = &quot;Select BuildingID, Building From tblBuilding Order by Building&quot;
Set RSbuilding = MyConnbuilding.Execute(SQLbuilding)
%>


<%Dim Count
Count = 1%>


<CENTER>

Please choose a Building :
<FORM METHOD=&quot;POST&quot; name=&quot;selectbuilding&quot; ACTION=&quot;./showselectedbuilding.asp&quot;>

<Select size=&quot;12&quot; name = &quot;buildingID&quot;>
<option selected>--Select Building--

<% While Not RSbuilding.EOF

if count = 1 then %>
<option style=&quot;color:red&quot; value=&quot;<%=RSbuilding(&quot;BuildingID&quot;)%>&quot;>
<%count = 2
else %>
<option style=&quot;color:blue&quot; value=&quot;<%=RSbuilding(&quot;BuildingID&quot;)%>&quot;>
<%count = 1
end if %>


<%=RSbuilding.Fields(&quot;Building&quot;)%>

<%
RSbuilding.MoveNext
Wend
%>

</select>

<%
RSbuilding.Close
MyConnbuilding.Close
Set RSbuilding = Nothing
Set MyConnbuilding = Nothing
%>
<BR>
<BR>
<input type=&quot;button&quot; onClick=&quot;SubmitForm('showselectedbuilding.asp');&quot; value=&quot;View Building&quot;>

<input type=&quot;button&quot; onClick=&quot;SubmitForm('printselectedbuilding.asp');&quot; value=&quot;Print Building&quot;>

</form>
</font></p></CENTER>
</form>
</td>
</tr>
</table>
</center></div>
</body></html>

thanks in advance.
 
Try using a record set .open method instead of the execute. I am not sure but I don't think you have full control of the recordset when you use the execute method of the connection object. Just a guess??



Eric Repec
eric@ericrepec.com
If its not broke try it make it faster.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top