|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Database connection errors..time-out?
Hi, I am what you call a total newbie to ASP but it is very exciting when you make your scripts work! Ive learned amny things from you guys on this forum but now i am a little bit stuck...
Anyway my problem is: I made an ASP page containing DSN-less connection data. I now use this page as a FILE INCLUDE item at the top of all my other ASP pages which need to connect to my database. This all works fine the first time you load the page i.e. the connection is made and the database contents are displayed on the screen. However, if I press the refresh button, the browser displays an error message saying there is now something wrong with my database connect ASP page (the page which I "include" in all the other ASP pages). If I then wait a couple of minutes and then press refresh it works again! But then if you press refresh again it wont work unless you wait another couple of minutes etc etc etc..... Could anyone help me with this problem? It is seriously eating up all my precious developing time! hehe...By the way im using IIS 6.0 on Windows Server 2003 Standard Edition. I created a new new sitein the IIS manager and left all the settings as they were. MANY thanks for any help! It is very much appreciated. Seb |
|
#2
|
|||
|
|||
|
do you close the connection and any recordset objects? are you properly destroying them? can you post the code you use to open the connection? can you post the exact error and what it occurs on?
__________________
Programmer's Corner |
|
#3
|
|||
|
|||
|
Yeah no problem. First of all, here is the ASP page with the connection data within:
<% Dim objConn Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _ "DBQ=E:\PS2 Browser\faves.mdb" objConn.Open %> Now any page I use this code in is acheived by using the include file syntax. Each page has what I assume is the appropriate code to close the connections after they are used. Here is an example of a page which works with the connection, but doesnt work again when you press refresh: <%@ Language=VBScript %> <% Option Explicit %> <!--#include virtual="/adovbs.inc"--> <!--#include file="dataConnect.asp"--> <% Dim objRS, saveURL, saveName, bootMe bootMe = "faves.asp" Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open "tblURL", objConn, , adLockOptimistic, adCmdTable saveURL = Request.Form("saveURL") saveName = Request.Form("saveName") Do While Not objRS.EOF If objRS("urlName") = "empty" THEN objRS("urlAddress") = saveURL objRS("urlName") = saveName objRS.Update Response.Redirect bootMe End If objRS.Movenext Loop objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing %> Thanks for your time. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Database connection errors..time-out? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|