Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Posts
    4

    Unanswered: Problem calling stored procedure

    Any help on this would be much appreciated:

    I have a stored procedure, say, on Northwind demo db like:

    CREATE PROCEDURE up_CustCount @parm1 varchar(256) AS
    Begin
    select count(*) from customers
    end
    GO

    and the following VB code:

    Dim oCon As ADODB.Connection
    Dim oCmd As ADODB.Command
    Dim oParm As ADODB.Parameter
    Dim oRS As ADODB.Recordset


    Set oCon = New ADODB.Connection
    oCon.Provider = "SQLOLEDB"
    oCon.Properties("Integrated Security").Value = "SSPI"
    oCon.Open "Server=(local);Database=Northwind"

    Set oCmd = New ADODB.Command

    Set oCmd.ActiveConnection = oCon
    oCmd.CommandText = "up_CustCount"

    Set oParm = oCmd.CreateParameter("@parm1", adVarChar, adParamInput, 256, "asas")
    oCmd.Parameters.Append oParm

    Set oRS = oCmd.Execute
    MsgBox oRS.Fields(1)
    oRS.Close
    oCon.Close


    I just get an error "Procedure 'up_CustCount' expects parameter '@parm1', which was not supplied."

    But I have supplied it!

    Can anyone help please?

  2. #2
    Join Date
    Apr 2003
    Posts
    4

    Oops

    Found it.

    forgot to set the command type to adCmdStoredProc.

    /me shuffles.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •