I Normally create an includes connection page for all my SQL connections which make it easy to reference in my asp pages
an example of my connection asp page is
Asp page name - sqlconnection.asp
Code:
<%
'Declared SQL connection variables
Dim strSQLSN ' SQL Server Instance
Dim strSQLDBUN ' SQL Username
Dim strSQLDBPW ' SQL Password
Dim strSQLDB ' SQL Database name
'SQL Server current configuration
strSQLSN = "your-sever-name" ' SQL Server Instance
strSQLDBUN = "sql-login-name" ' SQL Username
strSQLDBPW = "your-password" ' SQL Password
strSQLDB = "your-database-name" ' SQL Database name
' Connection String
VirConn = "Provider=SQLOLEDB;Server=" & strSQLSN & ";User ID=" & strSQLDBUN & ";Password=" & strSQLDBPW & ";Database=" & strSQLDB & ";"
%>
Then in the asp pages i want to connect to the db i use
then include
Code:
'Open Connect to DB
set dbconn = server.CreateObject ("ADODB.Connection")
dbconn.connectionstring = VerConn
dbconn.Open
Hope this helps
Aspless