Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select * from MSDE table
Message
De
16/09/2003 13:28:13
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00829328
Message ID:
00829522
Vues:
21
>I ve got a connection to my MSDE database using
>
>gnConnHandle = SQLCONNECT('myServer', 'me')
>
>
>I should be connected to a database called myDB and there should be a table called myTable. How do I select all records from that table into a cursor called myCursor?
>
>
>select * from myDB!myTable! into cursor myCursor
>
Hi Einar,

Cetin showed you how to use the SQLExec statement. When I'm making really long SQLExec statements I use VFP's text merge:
lcParamter = "SomeParameter"
TEXT TO lcSQLStatement TEXTMERGE NOSHOW
SELECT * FROM MyTable 
WHERE SomeColumn = <<lcParameter>>
ENDTEXT
SQLExec(nConnection, lcSQLStatement, "ResultCursor")
Using the text merge makes coding the statements much easier than concatenating strings of code. Also, if you have the SQL Server client tools (Query Analyzer) then you can paste the text you've just generated right into the QA window and test there. (_ClipText = lcSQLStatement)

For development I do the SQLConnect() and SQLExec() right in the Command window until I get the results I want.

Besides using SQL Pass-through you can use a remote view, or a parameterized remote view. You can also make the cursor that results from the SQLExec into an updatable cursor. Each approach has its good points and bad points.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform