Tuesday, December 4, 2007

How do you use Global.asa to access your SQLServer

How do you use Global.asa to access your SQLServer

Use Global.asa to access your SQLServer

Here’s an example of codes that will allow you to do so

<% Set OBJdbConnection = Server.CreateObject("ADODB.Connection")

OBJdbConnection.ConnectionTimeout = Session("ConnectionTimeout")

OBJdbConnection.CommandTimeout = Session("CommandTimeout")

OBJdbConnection.Open Session("ConnectionString")

Set SQLStmt = Server.CreateObject("ADODB.Command")

Set RS = Server.CreateObject ("ADODB.Recordset")

%>

<%

SQLStmt.CommandText = "select * from authors"

SQLStmt.CommandType = 1

Set SQLStmt.ActiveConnection = OBJdbConnection

RS.Open SQLStmt

No comments: