Click to See Complete Forum and Search --> : Execute fails when calling Stored Proc on SQLOLEDB


scarleton
March 12th, 2003, 05:32 AM
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

scarleton
March 12th, 2003, 09:44 AM
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