Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'--- Creates a connection object for use from other functions
Function CreateConnection(connString)
Set CreateConnection = Server.CreateObject("ADODB.Connection")
CreateConnection.Open connString
End Function
'--- Executes a Stored Proc or SQL Query and returns a recordset
Function ExecProcToRS(procName, connString)
Dim eptr_conn, eptr_rs
Set eptr_conn = CreateConnection(connString)
Set eptr_rs = eptr_conn.Execute(procName)
Set ExecProcToRS = eptr_rs
'should probably close connection and set to nothing, but I believe that will kill the recordset
End Function
'--- Executes a stored proc or SQL Query and returns an array
Function ExecProcToArray(procName, connString)
Dim t_rs
Set t_rs = ExecProcToRS(procName, connString)
ExecProcToArray = t_rs.GetRows()
Set t_rs = Nothing
End Function
'--- executes a stored proc or query that returns no records
Function ExecProc(procName, connString)
Dim t_conn
Set t_conn = CreateConnection(connString)
t_conn.Execute procName
Set t_conn = Nothing
End Function
'execute a stored proc into myRS object
Dim myRS
Set myRS = ExecProcToRS("Execute sp_Bob arg1, arg2","my connection string")
'execute a stored proc to myArray
Dim myArray
myArray = ExecProcToArray("Execute sp_Bob arg1, arg2","my connection string")
'execute an SQL query with no return values
ExecProc("UPDATE mytable set a = b","my connection string")