Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select SQl data using arrays
Message
De
15/08/2009 13:59:39
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
15/08/2009 07:30:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01418215
Message ID:
01418252
Vues:
47
>>>The problem is that I DO NOT create the local cursor by selecting data from SQL server data.
>>
>>Then you are stuck for creating the string and pass it to SQL Server:
>>
>>lcKeys = []
>>SELECT LocalCursor
>>SCAN
>>   lcKeys = lcKeys + TRANSFORM(KeyField)+[,]
>>ENDSCAN
>>TEXT TO lcSQL NOSHOW TEXTMERGE
>>     SELECT * FROM YourTable WHERE SomeField IN (<<LEFT(lcKeys,LEN(lcKeys)-1))>>
>>ENDTEXT
>>IF SQLEXEC(sqlHandler, lcSQL, "NewVFPCursor") < 0
>>   AERROR(laError)
>>   MessageBox(laError[1,2])
>>ENDIF
>>
>
>Yes. I am afraid that I must create the stting.
>Thanks

That's the only way I've found so far, too. Depending on your ODBC driver, there may be a limitation to the length of your command string - 8K it was in my case when I last had to do this. If you have such a long list, you may be better off creating a temp table on the server, inserting your values into it, then using it in server-side select, then dropping the table. This way you chop the problem into smaller pieces - and have multiple trips to the server, of course.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform