Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL stored procedure returns empty recordset
Message
From
06/10/2005 11:41:11
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
SQL stored procedure returns empty recordset
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01056794
Message ID:
01056794
Views:
54
Stored procedure
CREATE PROCEDURE usp_test 
	@Number	INT
AS
SELECT @Number + 3
GO
is being called from VFP the following way
loRS = oData.oConn.Execute("usp_Test 3")
?loRS.Fields(0).Value	&&returns 6
Works fine.
oData.oConn is an ADODB.Connection

Stored procedure
CREATE PROCEDURE usp_dsp_TooLate2AddInvoice
	@Drv_CD	CHAR(8)
AS
DECLARE @TooLate		BIT
DECLARE @RecordsCheckedOut	INT
DECLARE @LatestCheckOut		DATETIME
SELECT @RecordsCheckedOut = COUNT(*)
	FROM dspCOutH
	WHERE Driver_CD = @Drv_CD AND Out_Dt IS NOT NULL
IF @RecordsCheckedOut = 0
	SET @TooLate = 0
ELSE
	BEGIN
	SELECT @LatestCheckOut = MAX(Out_DT)
		FROM dspCOutH
		WHERE Driver_CD = @Drv_CD
	IF DATEADD(ss, 300, @LatestCheckOut) > GETDATE()
		SET @TooLate = 0
	ELSE
		SET @TooLate = 1
	END
SELECT @TooLate
GO
is being called from VFP the same way
loRS = oData.oConn.Execute("usp_dsp_TooLate2AddInvoice '1001'")
?loRS.Fields(0).Value    &error
gives error "Member FIELDS does not evaluate to an object".
What is wrong with second function?

Second question. What would be the syntax to pass variable instead of literal?
lcDriver = '1001'
loRS = oData.Call_SP("usp_dsp_TooLate2AddInvoice lcDriver")
Next
Reply
Map
View

Click here to load this message in the networking platform