CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Location
    Cincinnati, Ohio
    Posts
    195

    Question Execute fails when calling Stored Proc on SQLOLEDB

    I am new to OLE DB. I am trying to run a Stored Proc on a Microsoft SQL database from VC++ 6.0 SP5. I am creating the the data source, the session, and the command text. Then I call SetCommandText with DBGUID_DEFAULT and DBGUID_SQL as the first param and "Call the_stored_proc()" as the second command. The stored proc does not take any parameters. Then when I call Execute, it fails with a 0x80040e14.

    My best guess is that I need to set some type of property with the ICommandProperties object that I can aquire from the command object.

    Am I correct? If so, what property do I need to set? Currently I am not setting any.

    Sam

  2. #2
    Join Date
    Dec 1999
    Location
    Cincinnati, Ohio
    Posts
    195
    I got things working. There where a number of problems, first off I was passing NULL in for the value of pcRowsAffected on the Execute command. The first param of the SetCommandText was wrong, the correct one is DBGUID_DBSQL.

    The REAL killer was the command text itself. The stored proc did not take any parameters, once I removed the parentheses it executed!

    Sam

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured