I am having some issues calling a stored procedure. I get an error that "the cursor is not open" when it tries to FETCH the output. The stored procedure simply returns the next record number off a stack and increments it up by 1.
I can get the procedure to execute with no errors, the error pops in the FETCH section.
String ls_recnum
ls_recnum = Space(100)
connect using sqlca;
DECLARE sproc_getevent PROCEDURE FOR dbo.sp_getevent
@result = :ls_recnum OUTPUT
USING SQLCA;
EXECUTE sproc_getevent;
If sqlca.SQLCode < 0 Then
MessageBox( "Error Calling proc - sp_getevent", sqlca.SQLErrText, StopSign!)
Return
End If
FETCH sproc_getevent INTO :ls_recnum;
If sqlca.SQLCode < 0 Then
MessageBox( "Error Fetching proc - sp_getevent", sqlca.SQLErrText, StopSign!)
Return
End If
CLOSE sproc_getevent;
MessageBox("RecNum", ls_recnum)
Any help would be appreciated.
Database C0038: SQLSTATE = 22005{Microsoft}{ODBC SQL Server Driver}Invalid character value for cast specification.
I have checked the argument for the stored procedure and have the right data type. It is Varchar(7) in the procedure and I have a string declared. I have seen several suggested fixes for this error, but none seem to fix the issue.
I have tried adding ;StripParmNames='Yes' and CallEscape='No' to the end of my connection string for the database.
If I remove the argument totally from the declare, it prompts me that it needs the @result parameter.
Any thoughts?