Answered by:
Sql Server stored procedure issue

Question
-
We have an app that was built in house. We call a stored procedure to Sql Server 2008. we have a live and test database. We have stored procedures. In the live version of the app, the call for the stored procedure works fine. In the test environment, the call returns a "-1". When I make the same call from Foxpro's command window, it runs fine. I put a trace on the Sql Server end. When the call was made from within the app, it shows the request and the successful completion. However, when I make the call such as iOK = sqlexec( connhandle, sp, cursorname ), iOK is equal to negative one. I can call the stored procedure from the command window. I can call it from within Sql Server Management Studio, and it runs fine. The only time it does not is when called within the app in the test environment, but it works fine in the live environment. Has anyone seen this before? I have compared the connection properties and I can find no obvious reason this happens.
Thanks for any ideas or suggestions
Friday, July 22, 2016 2:35 PM
Answers
-
Use AERROR() when the return value is negative to find out exactly what error you're getting.
IF m.iOK < 0 LOCAL aErrorInfo[1] AERROR(aErrorInfo) * Now look at the array aErrorInfo to see what it can tell you ENDIF
Tamar- Proposed as answer by Naomi N Monday, July 25, 2016 1:13 PM
- Marked as answer by Herro wongMicrosoft contingent staff Tuesday, August 2, 2016 1:32 AM
Friday, July 22, 2016 8:23 PMAnswerer
All replies
-
Use AERROR() when the return value is negative to find out exactly what error you're getting.
IF m.iOK < 0 LOCAL aErrorInfo[1] AERROR(aErrorInfo) * Now look at the array aErrorInfo to see what it can tell you ENDIF
Tamar- Proposed as answer by Naomi N Monday, July 25, 2016 1:13 PM
- Marked as answer by Herro wongMicrosoft contingent staff Tuesday, August 2, 2016 1:32 AM
Friday, July 22, 2016 8:23 PMAnswerer -
I suggest you check all directory/folder paths.
It sounds as if the test environment does not have a correct path somewhere.
The English Bob
Monday, July 25, 2016 11:46 AMAnswerer -
Do as Tamar says.
Especially, if you don't see anything on the server side in tracing, you should check out about open transactions and deadlocks.
Bye, Olaf.
Olaf Doschke - TMN Systemberatung GmbH
Monday, July 25, 2016 2:35 PM