Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select * from MSDE table
Message
From
16/09/2003 13:28:13
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00829328
Message ID:
00829522
Views:
22
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform