Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CA and SP
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01411094
Message ID:
01411409
Views:
44
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform