Information générale
Catégorie:
Codage, syntaxe et commandes
>>>Hi All!
>>>
>>>Im running my app with some Select INTO CURSOR.
>>>
>>>Sometimes I get the above error from VFP my code samle is as this:
>>>
>>>SELECT p3.dato,p3.ansatt,p3.ordre,p3.skift,;
>>> p3.avdeling,p3.jobb,p3.fastlonn,p3.fastdel,;
>>> p3.pverdi,p3.timer,;
>>> IIF(p3.snittlønn>maxlønn,maxlønn,p3.snittlønn) AS snittlønn;
>>> FROM proshoyv14 p3;
>>> INTO CURSOR andreprodukt1
>>>
>>>IF USED('andreprodukt')
>>>sele andreprodukt
>>>USE
>>>ENDIF
>>>
>>>USE dbf('andreprodukt1') AGAIN IN 22 ALIAS andreprodukt // here I get an error but not in all
>>>situations??
>>>
>>>Best regards
>>>
>>>Per Simmersholm
>>
>>The file for a cursor may or may not be a file on the disk. You need to:
>>
>>USE (dbf("andreproduckt"))...
>>
>>Vlad
>
>Thanks for your reply!
>
>It did not work!
>
>The funny thing is that this app where the problem occure is much shorter than the original app (with less cursor)
>
>Another thing is that when I put this code earlyer in my app:
>
>SELECT avdeling.*,job.jobnavn,job.jobnr,job.akkbehand,;
> lonnsart.lønnsartnavn,lonnsart.lønnsartnummer,;
> lonnsart.behandling;
> FROM avdeling,job,lonnsart;
> WHERE avdeling.avdnr=job.avdeling;
> AND job.lønnsartnr=lonnsart.lønnsartnummer;
> INTO CURSOR prtavdjob1
>
>
>IF USED('prtavdjob')
>sele prtavdjob
>USE
>
>ENDIF
>
>USE (DBF('prtavdjob1')) IN 12 AGAIN ALIAS prtavdjob
>SELECT prtavdjob
>INDEX ON STR(avdnr,4)+STR(jobnr,4) TAG avdnr
>
>The error message occured in a different place later in the .prg file.
>
>Best regards
>
>Per Simmersholm
I would say that something is wrong with your app. Maybe a corrupted file. It's the first time I hear about this problem.
Can you simulate this in a small program? Ie: First SELECT SQL, use theresult again in a different area, etc. Just this and have the same behavior?
As a suggestion that will not make your code work if it doesn't but it's a good practice:
Never hard code area numbers. Always open your tables in 0. Ie: USE ... IN 0 or
SELECT 0 and USE ...
This way your code doesn't depend on the hardcoded area numbers and you avoid a nasty bug: you never close (by mistake) a table by opening another in the same area.
Vlad
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement