I've placed more of the code at the bottom of this message. The problem is with the Insert command with SQLEXEC.
If I use:
lcStr = ["INSERT INTO SAUTHORS(firstname,lastname) values ('] + m.firstname + [','] + m.lastname + [')"]
lnResult=SQLEXEC(m.lnConn, m.lcStr)
The error I get says: Connectivity error:...Could not find stored procedure 'INSERT INTO SAUTHORS(firstname,lastname) values ("Kareen","Abdul-Jabar")'.
If I use:
lcStr =
['INSERT INTO SAUTHORS (firstname,lastname) values ("] + m.firstname + [","] + m.lastname + [")']lnResult=SQLEXEC(m.lnConn, m.lcStr)
I get an error that says Invalid Syntax. Can someone steer me in the right direction I want to populate empty SQL Server Express tables with data from FoxPro tables (that are getting too big). Thank you!
USE authors IN 0
SELECT *;
from authors;
WHERE pkey > 0;
INTO CURSOR sqlAuthors readwrite
USE IN AUTHORS
SELECT sqlAuthors
INDEX on UPPER(lastname)+UPPER(firstname)+UPPER(middle) TAG lastname
lnConn=SQLSTRINGCONNECT("dsn=DataSrc1;UID=MOMNEW\Diana;PWD=")
=SQLEXEC(m.lnConn, 'use books') && use sauthors
= SQLSETPROP(m.lnConn, 'Transactions', 2) && Manual transactions
SELECT sqlAuthors
SCAN
llSuccess = .t.
SCATTER MEMVAR MEMO
firstname = ALLTRIM(m.firstname)
middle = ALLTRIM(m.middle)
lastname = ALLTRIM(m.lastname)
lcStr = ["INSERT INTO SAUTHORS(firstname,lastname) values ('] + m.firstname + [','] + m.lastname + [')"]
lnResult=SQLEXEC(m.lnConn, m.lcStr)
IF lnResult = -1
llSuccess = .f.
=MESSAGEBOX(MESSAGE(),0,"ERROR OCCURRED")
ENDIF