473,473 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Centrilized Data Connection

Hi,

I have several ASP pages, and some of them are using the same access
Database and table.
Can I put the connection string somewhere centralized, so I can link to it ?

Thx in advance

TNGgroup
Jul 19 '05 #1
2 1168
TNGgroup wrote on 10 aug 2004 in
microsoft.public.inetserver.asp.general:
I have several ASP pages, and some of them are using the same access
Database and table.
Can I put the connection string somewhere centralized, so I can link
to it ?


<!-- #include virtual = "/dbLib/myDbConnectionString.asp"-->

It is also a nice possibility to put your login check in the same file:

=== myDbConnectionString.asp:

<%
Response.Expires = 0 ' or whatever

if session("user")="" then redirect "logon.asp"

if Application("Local") = "yes!" then ' [set by local global.asa]
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath("./myDB.mdb") & ";"
else
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath("/cgi-bin/myDB.mdb") & ";"
end if
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2
THX !!

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
TNGgroup wrote on 10 aug 2004 in
microsoft.public.inetserver.asp.general:
I have several ASP pages, and some of them are using the same access
Database and table.
Can I put the connection string somewhere centralized, so I can link
to it ?


<!-- #include virtual = "/dbLib/myDbConnectionString.asp"-->

It is also a nice possibility to put your login check in the same file:

=== myDbConnectionString.asp:

<%
Response.Expires = 0 ' or whatever

if session("user")="" then redirect "logon.asp"

if Application("Local") = "yes!" then ' [set by local global.asa]
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath("./myDB.mdb") & ";"
else
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath("/cgi-bin/myDB.mdb") & ";"
end if
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
13
by: Larry | last post by:
Hi I have asp.net programs. I used a very simple data transfer method by using URLs ˇ°First.aspxˇ± contents a line to send data to the ˇ°second.aspxˇ± page, for
2
by: Lior | last post by:
Hi, I have an ASP.NET website that crashes under heavy load. I use a SQL Server DB. I get around 5500 hits per day. I keep getting the timeout expieried connection pool error. Sometimes it even...
18
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
35
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
6
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.