Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp sql
Message
 
To
23/11/2003 04:34:31
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00852721
Message ID:
00852724
Views:
6
Hi - not exactly sure how you are wanting to do this - if using the Query Analyser you can use this:
USE NORTHWIND
SELECT *
FROM customers
WHERE postalcode LIKE 'E%'
If you are wanting to connect to SQL Server from VFP and execute your SQL select statement then this:
PUBLIC gnConnHandle
LOCAL llConnected, lcCommand
STORE -1 TO gnConnHandle
STORE .F. TO llConnected
STORE "" TO lcCommand
=SQLSETPROP(0, "DispWarning", .F.)
=SQLSETPROP(0, "DispLogin", 3)
STORE SQLSTRINGCONNECT("DRIVER=SQL Server;SERVER=PREXP01;UID=USER;PWD=PASS;APP=Microsoft® Visual FoxPro®;WSID=PREXP01;DATABASE=Northwind") TO gnConnHandle
IF gnConnHandle < 0
   =MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
ELSE
   =MESSAGEBOX('Connection made', 48, 'SQL Connect Message')
   llConnected = .T.
ENDIF
IF llConnected THEN
	lcCommand = "SELECT * FROM customers WHERE postalcode LIKE 'E%'"
	=SQLEXEC(gnConnHandle, lcCommand, "curTemp")
	SELECT curTemp
	BROWSE
	USE IN curTemp
	=SQLDISCONNECT(gnConnHandle)
ENDIF
Not sure if that helps or not...
Chris Maiden
Email
Web
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform