Using adCmdStoredProc

Results 1 to 3 of 3

Thread: Using adCmdStoredProc

  1. #1
    Join Date
    Dec 1969

    Default Using adCmdStoredProc

    Hello,<BR><BR>I have the code:<BR><BR>SQL = "EXEC GetSeeAlsoFiles " & ID<BR>Set Conn = Server.CreateObject("ADODB.Connection")<BR>Conn.Op en ConnStr<BR>Set RS = Server.CreateObject("ADODB.Recordset")<BR>RS.Open SQL, Conn, adOpenForwardOnly, adLockReadOnly, adCmdText<BR><BR>This works fine and returns what it should do, however when I try and switch the type from adCmdText to adCmdStoredProc it dies giving:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80040e14&#039; <BR>[Microsoft][ODBC SQL Server Driver]Syntax error or access violation <BR><BR>What am I doing wrong?<BR><BR>Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Using adCmdStoredProc

    When using adCmdStoredProc you can only supply the procedure name in the sql string. <BR><BR>For parameters, use the parameters collection of the command object.

  3. #3
    Join Date
    Dec 1969

    Default Not necessary

    oRS.Open "MyProc(" & sID & ")",oCon,adOpenStatic, adLockReadOnly,adCmdStoredProc<BR><BR>Adjust the cursor options as needed. For varchar parameters:<BR><BR> oRS.Open "MyProc(&#039;" & sVal & "&#039;)",oCon,adOpenStatic, adLockReadOnly,adCmdStoredProc

Posting Permissions

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