Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Send Variables to a sql view
Message
De
16/04/2004 10:31:41
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
15/04/2004 19:00:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00894597
Message ID:
00895533
Vues:
21
>>I don't get the error but I don't get a record set returned either.
>>adding a +?Morder seemes to simply make the last statement a query rather than make it a seperate query plus an order statement.
>>mORDER = 'ORDER BY BRAND, CATEGORY, DESCRIPT '
>
>That surely won't work. When creating a remote view, you're basically writing a select statement in the language of the remote server. VFP can help you by providing variables which will be substituted at runtime - but that doesn't include macros. Macros don't exist in the remote language, and VFP's parser won't expand them for you.
>
>= We are using VFP 7.0, would 8.0 help this issue? It seems a shame that VFP won't let you manipulate MS-SQL just like you manipulate local DBF's.

The view is a sort of a compiled and stored SPT-select statement, where most of the backend manipulation is done for you, behind the scenes. If you want to go beyond its limitation, you can always roll your own. The SQL statement sent to the server is just another long string... which we know how to chop and fry, right?

>SQLExec() won't raise an error, but it will return a -1 if there was an error, and you can issue an aError(aErrArray) to get the ODBC error message into aErrArray, which you can then inspect.
>= Is this the infamous "pass through techology" that I have heard so much about? Someone else suggested this way but I have heard it is somewhat complex to implement.

SPT means you are sending strings full of SQL commands directly to the SQL (or other) backend, and receiving error codes and/or data. These cursors (aka SPT cursors) are pretty much the same as those created by a Create Cursor or Select ... readwrite, except that they can be made updatable, just like remote views.

Pulling data from server is not hard - I'm doing it dozen times a day in the command window (OK, omitting heavy joins there, just the simpler stuff). It's making the SPT cursors updatable that requires a set of statements issued against the cursor - but then you can just copy the dbsetprop() statements that GenDBC.prg generated for your view (or what the View SQL option in the View Designer in vfp8 shows). Search Wiki and here for SPT and Updateable (or updatable - spelling differs...).

Or you don't even need updatable cursors. You can always send your own update, insert and delete statements to the server. To make things easier, the ?variable still works there, so you can say sqlexec(h, "update mytable set field1=?myVal1 where key1=?lckey").

>I was thinking that the best way to do my tasks was get all the variables defined and then query the database and return the set I wanted.
>
>Thank you for your quick responses. BTW I am a newbie with just enough knowledge to be dangerous.

Both sentences are a sign of good thinking. Welcome to the SPT jungle :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform