Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql Syntax
Message
 
À
14/05/2003 08:25:44
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00788122
Message ID:
00788136
Vues:
24
>I need to know how to state a variable in an Insert Into sql command.
>
>Set oConn = CreateObject("adodb.connection")
>myvariable = WorkSheets("Sheet1").Cells(1,1).Value
>oConn.Open("sde123")
>oConn.Execute("Insert Into mytable(field1, field2) Values(myvariable,"")
>oConn.Close
>
>Note this is code I am using in Excel to feed data into VFP. It works fine if I hard code the values but I need the flexibility of the variable.
Set oConn = CreateObject("adodb.connection")
myvariable = WorkSheets("Sheet1").Cells(1,1).Value
oConn.Open("sde123")
oConn.Execute("Insert Into mytable(field1, field2) Values("+myvariable+',""')
oConn.Close
or
Set oConn = CreateObject("adodb.connection")
myvariable = WorkSheets("Sheet1").Cells(1,1).Value
oConn.Open("sde123")
oConn.Execute("Insert Into mytable(field1, field2) Values(?myvariable,"")
oConn.Close
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform