Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: Re: connectionstring


Message #1 by "Sanna Korpela" <sanna.m.korpela@l...> on Tue, 19 Jun 2001 10:34:08
> Hello Ken!

I'm still a beginner with ASP and have been trying to use Global.asa-file 

for declaring a connectionstring. Maybe you know answer to my problem? I 

would be most gratefull.

Below I copy some code from Global.asa, The ASP-page and the error-message 

received from the browser.



Global.asa

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart

	Application("ConnectString")="provider=SQLOLEDB; Data 

Source=ltnt152; Initial Catalog=tkr04; User Id=tkr04; Password=cqJyVV"

End Sub

Sub Application_OnEnd

	Application("ConnectString")=""

End Sub

Sub Session_OnStart

end sub

Sub Session_OnEnd

end sub

</SCRIPT>



The beginning of the ASP-page

<%@language=vbscript%>

<html>

<head>

<title>Taloyhtiön yhteystiedot</title>

</head>

<body>

<%set con=Server.CreateObject("ADODB.Connection")

con.open=Application("ConnectString")

%>



Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)

[Microsoft][ODBC Driver Manager] Data source name not found and no default 

driver specified

/Asp00/Tam99sa/SannaKorpela/expoin/yhteystiedot2.asp, line 8



Thank you,

Sanna

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> 

> You have two choices:

> a) Declare an application variable and store the connection string there

> b) Create an include file, store the connection string in a local 

variable

> in the include file, and include the file on every page.

> 

> IIS will cache the "compiled" output of each page (until it's buffer is

> full), so using an include file probably isn't any slower than using an

> Application variable, since the include process (physically reading the

> include file from the hard disk)  is only done once.

> 

> That said you still need to read the include file, and you cached pages 

end

> up being that much bigger.

> 

> Cheers

> Ken

> 

> 

> 

> 

Message #2 by "Ken Schaefer" <ken@a...> on Tue, 19 Jun 2001 20:09:51 +1000
Change con.open=Application("ConnectString") to



con.open Application("ConnectString")



(no = OK?)



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "Sanna Korpela" <sanna.m.korpela@l...>

To: "ASP Database Setup" <asp_database_setup@p...>

Sent: Tuesday, June 19, 2001 10:34 AM

Subject: [asp_database_setup] Re: connectionstring





: > Hello Ken!

: I'm still a beginner with ASP and have been trying to use Global.asa-file

: for declaring a connectionstring. Maybe you know answer to my problem? I

: would be most gratefull.

: Below I copy some code from Global.asa, The ASP-page and the error-message

: received from the browser.

:

: Global.asa

: <SCRIPT LANGUAGE="VBScript" RUNAT="Server">

: Sub Application_OnStart

: Application("ConnectString")="provider=SQLOLEDB; Data

: Source=ltnt152; Initial Catalog=tkr04; User Id=tkr04; Password=cqJyVV"

: End Sub

: Sub Application_OnEnd

: Application("ConnectString")=""

: End Sub

: Sub Session_OnStart

: end sub

: Sub Session_OnEnd

: end sub

: </SCRIPT>

:

: The beginning of the ASP-page

: <%@language=vbscript%>

: <html>

: <head>

: <title>Taloyhtiön yhteystiedot</title>

: </head>

: <body>

: <%set con=Server.CreateObject("ADODB.Connection")

: con.open=Application("ConnectString")

: %>

:

: Error Type:

: Microsoft OLE DB Provider for ODBC Drivers (0x80004005)

: [Microsoft][ODBC Driver Manager] Data source name not found and no default

: driver specified

: /Asp00/Tam99sa/SannaKorpela/expoin/yhteystiedot2.asp, line 8

:

: Thank you,

: Sanna

: > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

: >

: > You have two choices:

: > a) Declare an application variable and store the connection string there

: > b) Create an include file, store the connection string in a local

: variable

: > in the include file, and include the file on every page.

: >

: > IIS will cache the "compiled" output of each page (until it's buffer is

: > full), so using an include file probably isn't any slower than using an

: > Application variable, since the include process (physically reading the

: > include file from the hard disk)  is only done once.

: >

: > That said you still need to read the include file, and you cached pages

: end

: > up being that much bigger.

: >

: > Cheers

: > Ken

@p2p.wrox.com




  Return to Index