Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CA and SP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Divers
Thread ID:
01411094
Message ID:
01411409
Vues:
43
Did you try
SELECT * FROM SomeTable WHERE Fld1 = ? AND Fld2 = ?
>
>:-)
>It works, Thnak you AGAIN Sergey, but know I have problems with parameters. I can't make it work with more than one parameter:
>
>This works
>
>TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
>     SELECT * FROM SomeTable WHERE Fld1 = ?MyVar
>ENDTEXT
>
>oConn = CREATEOBJECT("ADODB.Connection")
>oConn.ConnectionString = ......
>oConn.Open()
>oComm = CREATEOBJECT("ADODB.Command")
>oComm.ActiveConnection = oConn
>oPar1 = CREATEOBJECT("ADODB.Parameter")
>oPar1.Direction = 1
>oPar1.Type      = 3  && adInteger 
>oPar1.Value     = 1
>oComm.Parameters.Append(oPar1)
>oComm.CommandText = m.lcSQL
>oRs = oComm.Execute()
>
>
>That didn't:
>
>TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
>     SELECT * FROM SomeTable WHERE Fld1 = ?MyVar1 AND Fld2 = ?MyVar2
>ENDTEXT
>
>oConn = CREATEOBJECT("ADODB.Connection")
>oConn.ConnectionString = ......
>oConn.Open()
>oComm = CREATEOBJECT("ADODB.Command")
>oComm.ActiveConnection = oConn
>oPar1 = CREATEOBJECT("ADODB.Parameter")
>oPar2 = CREATEOBJECT("ADODB.Parameter")
>oPar1.Direction = 1
>oPar1.Type      = 3  && adInteger 
>oPar1.Value     = 1
>
>oPar2.Direction = 1
>oPar2.Type      = 3  && adInteger 
>oPar2.Value     = 222
>oComm.Parameters.Append(oPar1)
>oComm.Parameters.Append(oPar2)
>oComm.CommandText = m.lcSQL
>oRs = oComm.Execute() &&& BOOM with "Unrecognized command ....
>
>
>I tried to name the parameters w/o any luck :-)
>
>If I leave ONLY [?] then second command works also, but I NEED them, because the application works with SQL Server connected with ODBC and I prefer sometimes to use SQLEXEC() :-))))
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform