Monday, December 17, 2007

How to connect to a database

How to connect to a database

S T E P - 1

- We need to use Server.CreateObject to create a ADO connection object.

Dim oConn

Set oConn = Server.CreateObject("ADODB.Connection")

S T E P - 2

- If you need this Connection object to be used in the whole ASP program, you can assign it to the Application environment:

Set Application("oConn") = oConn

S T E P - 3

- If you need this Connection object to be used in the Session environment:

Set Session("oConn") = oConn

No comments: