MSSQL DB Connection

Connects to MSSQL database from Classic ASP
All DB variables need to be already defined
DBServer, DBName, DBUser, DBPass
Content below is used to be in Inc_Conn.asp file and included inside tool ASP files

<%
Server.ScriptTimeout  = 200
' Variables needed to be set
' DBServer     = "db.server.com"
' DBName      = "DatabaseName"
' DBUser      = "dbadmin"
' DBPassword    = "pwdofdbuser"
Err.Clear
On Error Resume Next
Set Connection    = Server.CreateObject("ADODB.Connection")
ConnString      = "PROVIDER=SQLNCLI11 ;SERVER=" & DBServer & ";DATABASE=" & DBName & ";USER ID=" & DBUser & ";PASSWORD=" & DBPassword & ";"
' ConnString     = "PROVIDER={SQL Server} ;DATA SOURCE=" & DBServer & ";DATABASE=" & DBName & ";USER ID=" & DBUser & ";PASSWORD=" & DBPassword & ";"
Connection.Open ConnString
If Err.Number <> 0 Then Response.Redirect "/Error"
On Error GoTo 0

%>

Views 451 Downloads 143

'DBServer', 'DBName', 'DBUser and DBPass variables already defined', 'Database', 'DB', 'SQL', 'MSSQL', 'SSMS', 'Connect', 'include', 'SQLNCLI11', 'Native Server client 11'

ANmarAmdeen
324
Database Classic ASP
Revisions

v2.0