Re: How to use parameter or variable in a FOR clause by myalo
myalo
Sun Jul 20 16:15:42 CDT 2008
On Jul 20, 2:23=A0am, "Stefan Wuebbe" <stefan.wue...@gmx.de> wrote:
> "myalo" <mya...@gmail.com> wrote in message
>
> news:dad6565c-1ff4-4b49-affc-14d680281385@x36g2000prg.googlegroups.com...
>
> > Hi
> > I have the following code which give me an error. Any idea?
> > File test.prg
> > ----------------
> > PARAMETERS cond as String
> > SELECT dp
> > ? cond
> > browse FOR &cond
>
> > do test with "col1=3D9"
>
> > Error:
> > Command contains unrecognized phrase/Keyword
>
> Hi Myalo -
>
> This sequence works for me in the command window:
> =A0 =A0 CREATE CURSOR dp (col1 Int)
> =A0 =A0 cond =3D "col1=3D9"
> =A0 =A0 BROWSE FOR &cond
> =A0 =A0 INSERT INTO dp VALUES (3)
> =A0 =A0 INSERT INTO dp VALUES (9)
> =A0 =A0 BROWSE FOR &cond
>
> FWIW, personally I'd prefer something like this though:
> =A0 =A0 lnFilter =3D 9
> =A0 =A0 Select * from dp Where col1 =3D ?m.lnFilter
>
> hth
> -Stefan
>
> --
> =A0|\_/| ------ ProLib - programmers liberty -----------------
> =A0(.. ) Our MVPs and MCPs make the Fox run....
> =A0 - / =A0See us atwww.prolib.deorwww.AFPages.de
> =A0----------------------------------------------------------- =A0
thanks all. I did simplfy. I had a parameter name col1 and in the
table also col1 so the macro was refering to the value of col1 in the
table (my best guess). Changing params names fixed it.
maylo