Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Syntax Error
Message
From
12/08/2012 11:31:18
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01550355
Message ID:
01550371
Views:
76
Seem to remember when is was doing this stuff in vfp I had the best luck in using short aliases for tablenames to reduce the length of the string and first creating the entire where clause as a string then macro expanding as WHERE &str

made debugging a lot easier as well since I knew exactly what the where clause looked like before actually hitting the SELECT

haven't been following closely but of course the lcstring may being a comma separated list of character type but not have quotes around then. I
've had that bite me. Even more reason to build the whole where clause and look at it before the select runs

>My suspicion as well. Saifuddin, the next thing you should do is set a breakpoint on the SELECT statement and check the values of lcString and lcString1/2/3. Also do as suggested by Tore and create a variable called lcQuery and check its LEN().
>
>The syntax of the IN clauses also makes me a little nervous, for two reasons. One is VFP may be interpreting them as function calls due to the lack of spaces before the open parentheses. Also, the terms of an IN clause in VFP are supposed to be enclosed in parentheses, e.g. IN ('A', 'B', 'C').
>
>Good luck!
>
>>I'd check what is in your lcString* first.
>>
>>>Hi,
>>>
>>>I am facing a syntax error in the following SQL-Select, but I could not find it please guide..
>>>
>>>SELECT Simain.sino, Simain.invdate, Simain.pcode, Simain.location,;
>>>  Simain.cashname, Simain.salesman, Simain.merchand, Sisub.icode,;
>>>  Sisub.qntymaj, Sisub.qntymin, Sisub.ratemaj, Sisub.ratemin, Saleprog.zone,;
>>>  Kategory.maincat, Kategory.category, Kategory.subcat1, Kategory.subcat2,;
>>>  Icode.barcode, Icode.full_desc, Customer.full_name;
>>> FROM ;
>>>     vfas!simain ;
>>>    INNER JOIN vfas!sisub ;
>>>   ON  Simain.sino = Sisub.sino ;
>>>    INNER JOIN vfas!saleprog ;
>>>   ON  Simain.salesman = Saleprog.salesman ;
>>>    INNER JOIN vfas!kategory ;
>>>   ON  Sisub.icode = Kategory.icode ;
>>>    INNER JOIN vfas!icode ;
>>>   ON  Sisub.icode = Icode.icode ;
>>>    INNER JOIN vfas!customer ;
>>>   ON  Simain.pcode = Customer.pcode ;
>>>   WHERE tKategory.mainCat IN(&lcString) AND ;
>>>                           tKategory.category IN(&lcString1) AND ;
>>>                            tKategory.subCat1 IN(&lcString2) AND ;
>>>                            tKategory.subCat2 IN(&lcString3) INTO CURSOR Salqry1 READWRITE
>>>


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Reply
Map
View

Click here to load this message in the networking platform