Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2012, 02:32 PM
Registered User
 
Join Date: Jul 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile CLOSE DB connection or set timeout

Hi guys,

I have a website that only pulls data from a DB; there's no inserting a record or carrying over of data. It is a DB that displays the used cars in inventory (and can be sorted to display only be make, year, etc).
My problem is that when a person looks at my webpage a data connection is made. If the person leaves the page open on their computer and then for example, leaves it open all day; when I try to upload an updated DB it knocks out the ASP connection, and then I have to waste time trying to get the connections to close.

Therefore, I think I need a timeout function or something:

My connection file is this:

<%
' FileName="Connection_ado_conn_string.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_autoaction_STRING

MM_autoaction_STRING = "Driver={Microsoft Access Driver (*.mdb)}; Dbq=********.mdb"
%>
<% Timeout="200" %>
-----------------------------------------------------------------------

Then, the coding on one of the webpages for example, is
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/****.asp" -->
<%
Dim company
Dim company_numRows

Set company = Server.CreateObject("ADODB.Recordset")
company.ActiveConnection = MM_autoaction_STRING
company.Source = "SELECT CompanyName, Address1, Address2, City, ST, Zip, Phone, Fax, Email, Slogan, Hours, WelcomeMsg, GeneralInfo, LocationInfo, lastupdate FROM WebPageInformation"
company.CursorType = 0
company.CursorLocation = 2
company.LockType = 1
company.Open()

company_numRows = 0
%>
<%
Dim detail__MMColParam
detail__MMColParam = "1"
If (Request.QueryString("StkID") <> "") Then
detail__MMColParam = Request.QueryString("StkID")
End If
%>
<%
Dim detail
Dim detail_numRows

Set detail = Server.CreateObject("ADODB.Recordset")
detail.ActiveConnection = MM_autoaction_STRING
detail.Source = "SELECT * FROM WebInventory WHERE StkID = '" + Replace(detail__MMColParam, "'", "''") + "'"
detail.CursorType = 0
detail.CursorLocation = 2
detail.LockType = 1
detail.Open()

detail_numRows = 0
%>

BODY of page...irrelevant...
BUT, to close, I have
<%
company.Close()
Set company = Nothing
%>
<%
detail.Close()
Set detail = Nothing
%>

-------------------------------------------------------------------------

However, this still does not totally close the connection to the DB...

Please can someone help :)

Thank you in advance.

~M
 
Old August 2nd, 2012, 03:36 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

An open browser should not keep locks on a file at the server. Are you sure there's not other code causing this? Maybe you're not closing all your conections properly? Or maybe you have some client side code that repeatedly requests a page on the server?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection timeout msomar C# 2008 aka C# 3.0 2 May 31st, 2010 03:37 PM
Abort connection after timeout muklee Javascript How-To 0 June 17th, 2009 06:35 AM
How to set Oracle Stored Procedure Timeout jcslam Oracle 0 October 18th, 2004 03:38 AM
Command Object -- How to close db connection? wolfpack391 Classic ASP Databases 4 July 31st, 2004 05:28 AM
connection timeout apek PHP How-To 1 February 2nd, 2004 04:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.