Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with vfp and SQL
Message
De
04/11/1997 18:28:39
Sonny Chouinard
CHCA Computer Systems Inc.
Lachenaie, Québec, Canada
 
 
À
04/11/1997 16:03:33
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00058224
Message ID:
00058243
Vues:
38
Hi,

Try lcSQL= "SELECT * FROM Students WHERE loginId='"+lcStudentID+"'"
I think ODBC or SQL Server doesn't like "" for sring delimitation.
You must use '' instead...


>Can anyone tell me why this code is not returning any values from the Connection. If I use the Interactive SQL query program that comes with SQL 6.5, and give it [Select * from students where loginid="john"], the query returns the expected results. If I use the program below, gnConnHandle is a positive integer; however, lnResult is -1 and the query returns nothing.
>
>If I try this with lcSQL = "Select * from students" it works just fine. It seems that the where clause is causing the problem. What am I overlooking? Using vfp5.0, sql6.5, nt4.0
>
>STORE SQLCONNECT('MyDataBase', 'sa') TO gnConnHandle
>IF gnConnHandle <= 0
> RETURN
>ENDIF
>
>lcStudentID='john'
>lcPassword = 'n'
>lcSessionId=''
>
>lcSQL = 'SELECT * FROM students WHERE Loginid="' + lcStudentID +'"'
>lnResult = SQLEXEC(gnConnHandle, lcSQL, 'cStud')
>SELE cStud
>brow
>IF _TALLY = 0
> **-- generate error
> RETURN "Bad Student ID"
>ENDIF
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform