Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Run SQL Statement from a string
Message
De
11/08/2006 07:53:11
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
11/08/2006 07:41:02
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01144703
Message ID:
01144769
Vues:
13
>>How can I execute a SQL statement stored as a character string. In the example below lcSelect contains the SQL statement. How can I execute this statement using lcSelect?
>>
>>lcfile = "apdist"
>>lcCompany = "99"
>>
>>lcselect = "Select * from " + "d:\demo\pro73b\sampledata\" + ALLTRIM(lcfile) + ALLTRIM(lcCompany)
>
>BTW, use TEXT...ENDTEXT to create the string. It lets you create very large strings while keeping the entry of the select like you'd write it to run.
>
>
TEXT TO lcSelect TEXTMERGE NOSHOW
>SELECT * ;
>  FROM d:\demo\pro73b\sampledata\<<alltrim(m.lcFile)>>
>ENDTEXT
Mike,
He needs to preprocess this to remove semicolons and make it appear as a single line command. ie:
lcSelect = Chrtran(m.lcSelect,Chr(9)+';'+Chr(13)+Chr(10),Space(1))
I'd instead do:
Select * from ("d:\demo\pro73b\sampledata\" + ALLTRIM(m.lcfile-m.lcCompany))
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform