Hello,
I want to make a function that will connect to db when I call it and then I can use the connection it opened.
It's need to be a sub-procedure or a function?
Is it good?
I want to make a function that will connect to db when I call it and then I can use the connection it opened.
It's need to be a sub-procedure or a function?
Is it good?
Code:
<%
Sub connect()
dim DBServer
dim DBName
dim DBUser
dim DBPass
DBServer = ""
DBName = ""
DBUser = ""
DBPass = ""
Set c = Server.CreateObject("ADODB.Connection")
strConn = "Provider=SQLOLEDB; Data Source=" & DBServer & "; Initial Catalog=" & DBName & ";User Id=" & DBUser & "; Password=" & DBPass & "; Auto Translate=FALSE"
c.Open strConn
End Sub
%>
