ASP MSSQL Connection

1
21

While using asp my convention is to make a connection function inside asp block and to include it on all ASP Files

Sub OpenDatabase(ByRef dbConn)    Set dbConn = Server.CreateObject(“ADODB.Connection”) dbConn.ConnectionTimeout = 150 dbConn.CommandTimeout = 150 dbConn.Open “Provider=SQLOLEDB.1;Persist Security Info=False;User ID=username;Password=password;Initial Catalog=database name;Data Source=localhost”

end sub

savethis into SQLC.asp (SQL Connection)

and include in all asp pages like

<!–#include file=”sqlc.asp”–>

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here