Insert Data to MYSQL using Foxpro -
in foxpro using native table, when inserting new data.
sele table if seek(lcindex) update record else insert new record endif
if use mysql database, best , fastest way in foxpro code using spt? updating large number of records. 80,000 transactions.
thanks, herbert
i take jerry supplied 1 step further. when trying deal insert, update, delete sql pass through, can run terrible debugging problems based on similar principles of sql-injection.
what if "myvalue" field had single quote, double quote, double hyphen (indicating comment)? hosed.
parameterize statement such using vfp variable references, use "?" in sql statement qualify "value" should used. vfp passes. helps on data types, such converting numbers string when building "mystatement".
also, in vfp, can use text/endtext simplify readability of commands
lcsomestringvariable = "my test value" lnanumericvalue = 12.34 lnmyidkey = 389 text lcsqlcmd noshow pretext 1+2+8 update [yourschems].[yourtable] set sometextfield = ?lcsomestringvariable, somenumberfield = ?lnanumericvalue yourpkcolumn = ?lnmyidkey endtext =sqlexec( yourhandle, lcsqlcmd, "localcursor" )
Comments
Post a Comment