PRB: Invalid Return from SQL Server ODBC Driver Version 3.70.0623ID: Q237290
|
When executing a SQL Server stored procedure and passing parameters through SQL pass through, a return of -1 (error) might be received, even though the stored procedure is successfully executed. This occurs when writing data from a FoxPro MEMO field to a SQL TEXT column.
SQL Server Transact-SQL supports two methods of building SQL statements, at run time, in scripts, stored procedures, and triggers:
There are three ways to address this issue:
This behavior is by design.
LOCAL lnHandle, lcString, lnRetVal
lnHandle = SQLCONNECT ()
IF (lnHandle < 0)
MessageBox (MESSAGE(), 16, [Error!])
RETURN
ENDIF
WAIT WINDOW [Creating Table test_table...] NOWAIT
lcString = [DROP TABLE test_table]
lnRetVal = SQLEXEC (lnHandle, lcString)
IF (lnRetVal < 0)
=MessageBox ([The table does not exist. Press OK to create it], 16, [Error!])
ENDIF
lcString = [CREATE TABLE test_table (int_column int, text_column text)]
lnRetVal = SQLEXEC (lnHandle, lcString)
IF (lnRetVal < 0)
=MessageBox (MESSAGE(), 16, [Error!])
RETURN
ENDIF
*-- Create a stored procedure to insert data into the test table created
*-- above
WAIT WINDOW [Creating Stored Procedure test_table_proc...] NOWAIT
lcString = [DROP PROCEDURE test_table_proc]
lnRetVal = SQLEXEC (lnHandle, lcString)
IF (lnRetVal < 0)
=MessageBox ([The procedure does not exist. Press OK to create it], 16, [Error!])
ENDIF
lcString = [CREATE PROCEDURE test_table_proc (@int_column int, @text_column text) AS ]
lcString = lcString + [BEGIN INSERT INTO test_table VALUES (@int_column, @text_column) END]
lnRetVal = SQLEXEC (lnHandle, lcString)
IF (lnRetVal < 0)
=MessageBox (MESSAGE(), 16, [Error!])
RETURN
ENDIF
WAIT CLEAR
=SQLDISCONNECT (lnHandle)
LOCAL lnHandle, lcString, lnRetVal
lnHandle = SQLCONNECT ()
IF (lnHandle < 0)
MessageBox (MESSAGE(), 16, [Error!])
RETURN
ENDIF
*-- Create front-end cursor to store data
CREATE CURSOR data_for_table (int_column int, text_column memo)
INSERT INTO data_for_table VALUES (1, 'Sample Data')
*-- Send data to the server
lcString = [{CALL test_table_proc (?data_for_table.int_column, ?data_for_table.text_column)}]
lnRetVal = SQLEXEC (lnHandle, lcString)
IF (lnRetVal < 0)
MessageBox (MESSAGE(), 16, [Error!])
ENDIF
SQLDISCONNECT (lnHandle )
This code should cause the following error:
Connectivity error: Unable to retrieve specific error information. Driver is probably out of resources
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Trevor Hancock, Microsoft Corporation
Additional query words:
Keywords : kbSQL kbVFp300 kbVFp500 kbVFp500a kbVFp600 kbGrpFox kbGrpMDAC
Version : WINDOWS:3.0,3.0b,3.7,5.0,5.0a,6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: July 20, 1999