VoiceGuide IVR Software Main Page
Jump to content

Vbscript Dsn-odbc-queries

Recommended Posts

I have an ODBC connection set up to point to an Access Database which I can connect to with a Query Database module. However, I want to execute an access query directly and my understanding is that I need to use a VBScript module to do it. I have a VBScript module set up with the following code but I keep getting a "Object Required" error message. 'ADProd' is my ODBC connection name and "TestInsertQuery" is my query name. What am I doing wrong?

 

'Declare Vars

dim cmdCommand, prmParameter, rsRecordset, cnConnection, sParam

 

'Open Your Connection

set cnConnection= "DSN=ADProd;"

cnConnection.open

 

'Initialize Input Parameters

sParam = "My Param"

 

set cmdCommand= server.createobject("adodb.command")

set prmParameter= server.createobject("adodb.parameter")

set rsRecordset= server.createobject("adodb.recordset")

 

With cmdCommand

'Prepare Command

set .ActiveConnection = cnConnection

.CommandType = adCmdStoredProc

.CommandText = "TestInsertQuery"

 

'Parameter

set prmPartyView = .CreateParameter("@SPParameter", adVarChar, _

adParamInput,255,sParam )

.Parameters.Append prmParameter

 

'Execute Stored Procedure and return Recordset if needed.

 

set rsRecordset= cmdCommand.execute

End With

Share this post


Link to post
I keep getting a "Object Required" error message.

On which line does this error occur?

 

Best to just get the VBScript working first (save it in a .VBS file and run it direct) and then when it's working then place it in the 'Run VBScript" module.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×