Function ExecuteSQL(ByVal sSql, ByVal vCn)
Dim oRs, oCn, sTokens
sTokens = Split(sSql)
If (Ubound(sTokens) = 0) Then Exit Function
Set oCn = Server.CreateObject("ADODB.Connection")
oCn.Open vCn
If (InStr("INSERT UPDATE DELETE", UCase(sTokens(0)))) Then
oCn.Execute sSql
Else
Set oRs = Server.CreateObject("ADODB.Recordset")
oRs.CursorLocation = 3
oRs.Open sSql, oCn, 0, 4
Set oRs.ActiveConnection = Nothing
Set ExecuteSQL = oRs
End If
oCn.Close
Set oCn = Nothing
End Function