Figure 1   Database.asp


 <%
 Option Explicit
 Const g_modName = "Database.asp"
 
 '---------------------------------------
 
 Function GetDSN()
     
     GetDSN = "dsn=CustomerADO;uid=Customeruser;pwd=spot;database=CustomerStuff;"
         
 End Function
 
 '---------------------------------------
 
 Function ConvertToString(v)
     If IsNull(v) Then
         ConvertToString = ""
     Else
         ConvertToString = CStr(v)
     End If
 End Function
 
 '---------------------------------------
 
 Function RunWithRS( strSQL)
     'On Error Resume Next
     
     ' Set up Command and Connection objects
     Dim rs , cmd
     Set rs = CreateObject("ADODB.Recordset")
     Set cmd = CreateObject("ADODB.Command")
     
     'Run the procedure
     cmd.ActiveConnection = GetDSN()
     cmd.CommandText = strSQL
     
     cmd.CommandType = adCmdText
     
     rs.CursorLocation = adUseClient
     rs.Open cmd, , adOpenForwardOnly, adLockReadOnly
    
     Set cmd.ActiveConnection = Nothing
     
     Set cmd = Nothing
     'Set rs.ActiveConnection = Nothing
  
     Set RunWithRS = rs
     
 End Function
 
 '---------------------------------------
 
 Function RunWithRS_RW( strsql)
     on error resume next
     ' Set up Command and Connection objects
     Dim rs, cmd
     Set rs = server.createobject("ADODB.Recordset")
     Set cmd = server.createobject("ADODB.Command")
       
     'Run the procedure
     cmd.ActiveConnection = GetDSN()
     cmd.CommandText = strsql
     cmd.CommandType = adCmdText
     
     rs.CursorLocation = adUseClient
     rs.Open cmd, , adOpenDynamic, adLockBatchOptimistic
     Set cmd = Nothing
     
     Set RunWithRS_RW = rs
 End Function
 %>