Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INSERTING into SQL server table from VFP Cursor
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00985368
Message ID:
00985745
Views:
35
You don't have to build the entire SQL string by replacing values. The beauty of VFP is that you can use file variables in SPT calls. For example,
mySQL = "INSERT INTO u_cinvoices (u_cinum,u_cidate,u_ntotamt) VALUES (?cInum, ?cidate, ?ntotamt)"
Where values are variables your cursor/table being scanned.

>Thank you for your response.
>
>The simplest solution for now is probably to do as you suggest SCAN ...INSERT ...ENDSCAN.
>
>Using this method, I am able to insert strings as variables but I am having a problem when trying to populate data with variables created from dates and numbers
>
>How can I substitute mydate and myvalue variables in the INSERT statement below where mydate=date() and mynum= 999 ??
>
>mySQL= [INSERT INTO u_cinvoices (u_cinum,u_cidate,u_ntotamt) ]+;
> [ VALUES (]+;
> [ '&cinum' ]+[,]+;
> [ '2/10/05' ]+[,]+;
> [ 999 ]+[,]+;
> [ )]
>
>Thanks in advance
>Carmel
- Jayesh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform