Execute stored procedure in ActiveX script (vb script) in a SQL job

Posted on 2006-05-11
Last Modified: 2008-02-26
is this the right way to run a stored procedure from ActiveX script (vb script) in a SQL job?
Set cmdSp = CreateObject("ADODB.Command")
cmdSp.ActiveConnection = "Provider=SQLOLEDB;;database=dbPassetData;network=DBMSSOCN;uid=PassData;pwd=jH783Rew"
cmdSp.CommandText = "Dp_Adm_Select_MobileInfoToXml"
cmdSp.CommandType = 4
CmdSp.Parameters.Append CmdSp.CreateParameter("@C1ID", 3, 1,, 461)
CmdSp.Parameters.Append CmdSp.CreateParameter("@LID", 3, 1,, 1)
set RS = CmdSp.Execute
dim arrGuideJava: arrGuideJava = RS.GetRows()
set RS = nothing
set CmdSp = nothing

/ jenmat
Question by:jenmat
    LVL 6

    Expert Comment

    set adoConn= CreateObject("ADODB.Command")
    adoConn.connectionstring = "Provider=SQLOLEDB;;database=dbPassetData;network=DBMSSOCN;uid=PassData;pwd=jH783Rew"

    Set cmdSp = CreateObject("ADODB.Command")
    set cmdSp.ActiveConnection = adoConn
    LVL 6

    Accepted Solution

    Oh no, that's wrong. should be:

    set adoConn= CreateObject("ADODB.Connection")
    adoConn.connectionstring = "Provider=SQLOLEDB;;database=dbPassetData;network=DBMSSOCN;uid=PassData;pwd=jH783Rew"

    Set cmdSp = CreateObject("ADODB.Command")
    set cmdSp.ActiveConnection = adoConn

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now