Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert data via SQLexec
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01521368
Message ID:
01521372
Views:
61
This message has been marked as a message which has helped to the initial question of the thread.
>How can I insert data from my_local_table.dbf to my_remote_sql_table using SQLexec ?
>
>Please help me to complete the code below:
>
>
>
>
>
>thisform.status.Value = "Connecting..."
>thisform.status.BackColor = RGB(232,255,232)
>
>WAIT WINDOW TIMEOUT 1
>
>lcServer="siteground150.com"
>lcPort= 3306
>lcDatabase= "monitorr_acrisoft"
>lcUser= "monitorr_******"
>lcPassword="**********"
>lcStringConn="Driver={MySQL ODBC 5.1 Driver};Server=&lcServer;Port=lcPort;Option=16384;Stmt=;Database=&lcDatabase;Uid=&lcUser;Pwd=&lcPassword"
>
>SQLSETPROP(0,"DispLogin",1)
>
>thisform.status.BackColor = RGB(255,242,236)
>
>lnHandle=SQLSTRINGCONNECT(lcStringConn)
>thisform.status.Value = "Connected."
>thisform.status.BackColor = RGB(255,232,221)
>
>
>*****************************************************below I need the code to: ***********************************************
>
>use my_local_table
>  
>     scan for my_local_table.control = .F. 
>
>* insert   my_local_table.name, my_local_table.address into  my_remote_sql_table.name, address...
Try (check out syntax : http://www.w3schools.com/sql/sql_insert.asp)
scatter memvar
cSQL = "insert into my_remote_sql (Name,Address, ...) ('" + m.name + "','" + m.adderess + "','"... + ")"
sqlexec(lnHandle,cSql,,a)
Check out http://msdn.microsoft.com/en-us/library/1x933c7s(v=vs.80).aspx how to check for errors in the a array.

Good luck.



>
>* if insert is successful
> replace my_local_table.control with .T.
>
>endscan
>
>
>
>

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform