Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Centrilized Data Connection

Reply
Thread Tools

Centrilized Data Connection

 
 
TNGgroup
Guest
Posts: n/a
 
      08-10-2004
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


 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      08-10-2004
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)
 
Reply With Quote
 
 
 
 
TNGgroup
Guest
Posts: n/a
 
      08-10-2004
THX !!

"Evertjan." <> wrote in message
news:Xns95416D303431Eeejj99@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)



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No "Wireless Network Connection" available in network connection =?Utf-8?B?am9raW5kYTE=?= Wireless Networking 7 10-16-2012 07:32 AM
VPN connection issue; no data passing after connection brian.s Cisco 3 08-22-2007 05:37 PM
ICS works with wired connection, fails with wireless connection Rich Wireless Networking 0 11-16-2005 06:48 PM
Wireless Connection drops / PS2 connection Steve Wireless Networking 1 07-27-2005 01:27 PM
Not seeing Wireless Connection in Network Connection =?Utf-8?B?bW90b21hbm1hdHQ=?= Wireless Networking 4 03-05-2005 04:39 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57