Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting
Message
From
03/10/2005 16:25:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/10/2005 16:09:52
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01055622
Message ID:
01055629
Views:
11
>There is a stored procedure as simple as this:
>CREATE PROCEDURE sp_test AS
>RETURN 33
>GO
>
>I'm trying to get the return value from VFP using ADO:
>LOCAL loConn AS ADODB.Connection, lvRetVal
>CLEAR
>loConn = CREATEOBJECT("ADODB.Connection")
>loConn.ConnectionString = GetConnString()
>loConn.Open()
>
>* 1 - Execute
>lvRetVal = loConn.Execute("sp_Test")
>?VARTYPE(lvRetVal), lvRetVal &&Shows O (Object)
>
>* 2 - as a native method
>lvRetVal = loConn.sp_Test() &&Crashes
>?VARTYPE(lvRetVal), lvRetVal
>
>loConn.Close()
>
>First call returns an object and as I can see from debugger it's a recordset. How would I get the number SP actually returns?
>
>Second call is supposed to be working according to Microsoft. I'm getting an error:
>"OLE IDispatch exception code 0 from ADODB.Connection: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another..."
>But there is no arguments. What does it want from me?
>
>Thanks

It's a scalar call where returned recordset has only one column and one row.

? lvRetVal.Fields(0).Value

I never thought second is supposed to work. Where does it say it should work?
PS: You should never name your stored procedures with sp_ or xp_ prefixes.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform