Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL command too complex - what should I do?
Message
 
 
À
13/12/1999 15:24:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00301958
Message ID:
00303495
Vues:
30
Hi Jim,

>It's good indeed that you solved your problem!

Yes, I solved the problem, using cursor (additional property CursorName and FieldLen) in our class btcc_multilist. I'm afraid, that I need to give your more details about btcc_multilist and the instance of this class on my form in order to describe the problem.

Ok, I have a class, called btcc_multilist, which allows to make multiple choices, include or exclude list of codes. This class has lots of methods, one of them is btc_wherexp, which returns criterion.
On our form we have several multilists. On Location page we have:
Counties Towns Registries,

where list of Towns depends on Counties and Registries (if a user selects few counties, we should display only towns in these counties).
So, we have sqlcommand for towns like:
select fullname, towns where town<>'ZZZ' and town<>'RRRR' &cccrit ®crit order by fullname into array this.btcvalarray.

In the method, which updates current list of towns I have:
cccrit=thisform.pageloc.btc_counties.btc_whereexp()
same for regcrit.
Then cmd=this.sqlCommand
&cmd

If I select too many counties, I saw the error, I described. I'm sure we run into macro limitation problem.

Right now I solved it, using cursors of user selected records, as Ed Rauh advised. It works.

>But I remain confused as tothe source of the *original* problem. You indicated strongly that it was a 'macro length limitation' problem in your estimation. My confusion is that I would not think that you would get a "SQL command too complex..." message in that case, but rather a simple syntax error.
>
>Can you clarify (just so that I can add to my list of oddities)?
>
>Thanks,
>
>Jim N
>
>>Ed,
>>
>>>>>Again, putting the values into a cursor and using an IN (subquery) may help with some of the length issues. There's no limit on the number of records in a subquery AFAIK.
>>>>
>>>
>>>Either that, or adding code to what you emit to convert your INLIST string into values used to populate a cursor, You aren't limited to what can be done in the scope of a single command - you can emit a fairly complex procedure, using conditionals, loops, or whatever else is needed to set up for the query, or massage the results before returning.
>>
>>Ok, I've changed my btcc_multilist to use advantage of cursor. Works fine.
>>Thanks again for your ideas.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform