Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp sql
Message
 
À
23/11/2003 04:34:31
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00852721
Message ID:
00852724
Vues:
5
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform