| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 29036 | 2003-01-08 10:26:00 | sc0ut (2899) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 112009 | 2003-01-08 10:26:00 | Ive been going to sites and I cant find out when to close my database connections This is my connection <% Set MyConn = Server.CreateObject("ADODB.Connection") MdbFilePath = Server.MapPath("database.mdb") MyConn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";" %> and here is closing <% dbconn.Close() %> Now here is the question: Do I close it on the bottom of every page or where?, because all the sites I go to say to close it when you have finished with the database Its for my personal e-mail home site Any ideas?? |
sc0ut (2899) | ||
| 112010 | 2003-01-08 18:01:00 | Hey dbconn.Close tells the DataReader and database connection after access to the database is no longer required, and therefore closes the connection. So you only need it on pages that you use to access your database. CyberChuck |
cyberchuck (173) | ||
| 112011 | 2003-01-08 19:58:00 | Site contains a number of pages - in this example pages A to G. Pages A, F, G - html only, no database access so don't close. Pages B, C, D, E - all require database access. Open it at the top of each of these pages and close it at the end of each of these pages. Also, suggest you make one file for the database connection and use INCLUDE on each of the relevant pages. (Makes it easy to change the path if needed - one place only). |
Heather P (163) | ||
| 112012 | 2003-01-08 21:51:00 | OK so at the bottom of each asp page that uses MDB and i am useing #includes |
sc0ut (2899) | ||
| 1 | |||||