Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQLEXEC() column names from variables?
Message
De
18/09/2003 10:20:00
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
18/09/2003 09:53:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00830266
Message ID:
00830282
Vues:
16
This message has been marked as the solution to the initial question of the thread.
>The following code works;
>
>
SQLEXEC(gnConnHandle,"INSERT into essStationData "+;
"(cfgStationID,essNTCIPTimeStamp,essPrecipSituation,"+;
"essPrecipYesNo,essPrecipitationEndTime,essPrecipitationStartTime,"+;
"essVisibilitySituation,essWindSituation) "+;
"values (?_station.cfgStationID,?timestamp,?v1,?v2,?v3,?v4,?v5,?v6)")
>
>
>
>but if I try to pass the column names from variables thusly;
>
>
SQLEXEC(gnConnHandle,"INSERT into ?rwTable "+;
"(cfgStationID,essNTCIPTimeStamp,?f1,?f2,?f3,?f4,?f5,?f6,?f7,?f8)"+;
" values (?_station.cfgStationID,?timestamp,?v1,?v2,?v3,?v4,?v5,?v6,?v7,?v8)")
>
>
>
>I get an error from the ODBC driver. My problem is that I have a variable set of columns that I need to operate on, so need to somehow virtualize the column names.
>
>Is there a better way to do this?
>
>TIA

You could either do it through stored procedures or build with fieldnames with set textmerge. ie:
set textmerge to memvar myVar noshow
set textmerge on
\\insert into <<rwTable>>
\\   (cfgStationID,essNTCIPTimeStamp,
\\<<m.f1>>,<<m.f2>>,<<m.f3>>,<<m.f4>>,<<m.f5>>,<<m.f6>>,<<m.f7>>,<<m.f8>>)
\\   values
\\   (?_station.cfgStationID,?timestamp,?v1,?v2,?v3,?v4,?v5,?v6,?v7,?v8)  
set textmerge to
set textmerge off
SQLExec(gnConnHandle,m.myVar)
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
Répondre
Fil
Voir

Click here to load this message in the networking platform