Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADODB.Connection in Include file
Message
 
To
26/05/2004 12:30:08
General information
Forum:
Visual Basic
Category:
VBScript
Miscellaneous
Thread ID:
00907423
Message ID:
00907460
Views:
12
>I am trying to create and open an ADODB.Connection in asp file, then include this file at the begining of my page, but in the code:
>
>
><SCRIPT LANGUAGE=VBScript>
></SCRIPT>
>
>
>i do not have access to the connection variable declared in the include file.
>
>in the body i have access to the variable, without any problem.
>
><BODY>
><%=cn.ConnectionString  
></BODY>
>
>
>is it possible to access the variable from the VBScript code?

Wilson;

I use the code below as an include file on my ASP pages but you can hard code it into your ASP.
< %@ Language=VBScript % > ' First line at top of ASP Form...

< %

Dim strConn

' Production...
strConn = "Driver={SQL SERVER};SERVER=T22;DATABASE=Business;UID=User;PWD=WebUser;"

% >
'-----------------------------------------------------------------------------
' Declare ADO Constants...
'-----------------------------------------------------------------------------
Const adOpenStatic = 3
Const adUseClient = 3

< %
'-----------------------------------------------------------------------------
' ADO 
'-----------------------------------------------------------------------------
' Establish connection...
	Set oConn = Server.CreateObject("ADODB.Connection")
	oConn.Open strConn	
		

' Create a Recordset...
	Set oQPRRS = Server.CreateObject("ADODB.Recordset")
	
	
	with oQPRRS
		.CursorLocation = adUseClient
		.CursorType = adOpenStatic
		.Open strSQL, oConn
	end with

% >
< HTML >
< HEAD >
It might be better to ask such questions in the Dot NET forum under ASP Classic.

Tom
Previous
Reply
Map
View

Click here to load this message in the networking platform