Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql Syntax
Message
 
To
14/05/2003 08:25:44
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00788122
Message ID:
00788136
Views:
25
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform