I'm testing a procedure to update a table on a SQL Server device. The code below what I've come up with to accomplishe the update. It does give an error but does not work, that is the SQL Server table does not display the added record. My first time playing with CursorAdapter...can anyone help?
lcConnString = "driver={SQL Server};server=ESCDB1;UID=;APP=Microsoft Visual FoxPro;DATABASE=FINCON;Trusted_Connection=Yes"
LOCAL loCursor AS CURSORADAPTER, laErrors[1]
loCursor = CREATEOBJECT("CursorAdapter")
WITH loCursor
.DATASOURCETYPE = "ODBC"
.DATASOURCE = SQLSTRINGCONNECT(lcConnString)
.AllowUpdate = .t.
.AllowInsert = .t.
.tables = "PASCODE"
.KeyFieldList = "pal, wing, unit, pas4, pas8m, parentpas, location"
.INSERTCMD = ;
"INSERT INTO PASCODE ( pal, wing, unit, pas4, pas8m, parentpas, location) VALUES ('V2', '38 EIG', 'F9XN', 'TE1MF9XN', 'FB59', 'Tinker')"
IF AERROR(laErrors) > 0
MESSAGEBOX(laErrors[2])
ENDIF
ENDWITH
lcConnString = "driver={SQL Server};server=ESCDB1;UID=;APP=Microsoft Visual FoxPro;DATABASE=FINCON;Trusted_Connection=Yes"
LOCAL loCursor AS CURSORADAPTER, laErrors[1]
loCursor = CREATEOBJECT("CursorAdapter")
WITH loCursor
.DATASOURCETYPE = "ODBC"
.DATASOURCE = SQLSTRINGCONNECT(lcConnString)
.AllowUpdate = .t.
.AllowInsert = .t.
.tables = "PASCODE"
.KeyFieldList = "pal, wing, unit, pas4, pas8m, parentpas, location"
.INSERTCMD = ;
"INSERT INTO PASCODE ( pal, wing, unit, pas4, pas8m, parentpas, location) VALUES ('V2', '38 EIG', 'F9XN', 'TE1MF9XN', 'FB59', 'Tinker')"
IF AERROR(laErrors) > 0
MESSAGEBOX(laErrors[2])
ENDIF
ENDWITH