Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collection object and not all of This
Message
From
05/10/2014 06:44:45
 
 
To
05/10/2014 05:43:58
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01608770
Message ID:
01608789
Views:
38
>Thank you, Dragan.
>
>I see your point but I think this is not fully the case of missing or being baffled with This reference.
>
>I rewrote the Parameters Collection class as Empty and the program works fine (that is, recognizes the parameter source):
>
>	FUNCTION buildQuery
>
>		SQLPREPARE(This.Remote, "SELECT * FROM " + This.TableName + ;
>										" WHERE " + This.RowId + " = ?This.Parameters.id")
>
>	ENDFUNC
>
>
>And I know it's not a don't-call-an-object-method issue because I circumvent the problem by creating a local reference the This.Parameters Collection, not by putting the value of its items in variables.


Hi Antonio:

If you open VFP Help and, on search tab, you write "sql and parameters", you will find that Dragan is right,
Even if using properties (like "?This.Parameters.id") may work, they are intended for variables, and there is reason for this. If you look at "Using SQL Server Input/Output Parameters" chapter, you will find this between other examples:
resultCode = SQLExec(connHand, 
"CREATE PROCEDURE sp_test; 
@mult1 int, @mult2 int, @result int; 
OUTPUT AS SELECT 
@result = @mult1 * @mult2") 
or this one:
resultCode = SQLExec(connHand, ; 
"{CALL sp_test (2, 4, ?@outParam)}") 
Some variables are for input and output, which means that the value can be replaced, and this won't happen with properties.

And in this chapter, the "Defining Parameters" section states this:

"When you implement input/output parameters, define the Visual FoxPro variables you want to include in your SQL pass-through command before you use the variables in the SQL statement"

As you see, it mention "VFP variables", not properties. May be properties work for "input only" data, but I'm not sure of the special cases of this use.


Regards.-
Fernando D. Bozzo
Madrid / Spain
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform