CURSORSETPROP( "TABLES", "ITCR42KDAT.UDFields", lcCursor )It keeps saying that "No table is open in the current work area".
WITH thisform LOCAL a,g,x,lcUpdFields,lcUpdNames IF ISNULL(.oCon) .oCon = NEWOBJECT('ConMgr','conmgr.prg') ENDIF .nCon = .oCon.OpenConn('itc_H_drive') IF .nCon < 1 MESSAGEBOX('connection failed') RETURN .f. ENDIF * MESSAGEBOX('connection successful!!!') SQLSETPROP(.nCon,"Asynchronous",.f.) lnRes = SQLSETPROP( .nCon, "DispWarnings", .F. ) g = '444-44-4444' lcSql = " Select *" ; + " FROM UDFields UD" ; + " where UD.SSNo = '"+g+"'" lcCursor = SYS(2015) IF USED(lcCursor) TABLEREVERT(.t.,lcCursor) ENDIF lnRes = SQLEXEC( .nCon, lcSql, "lcCursor" ) IF lnRes > 0 x = RECCOUNT() SELECT lcCursor AFIELDS(fieldinfo) ****Define fields to be updated lcUpdFields = '' lcUpdNames = '' FOR i = 1 TO ALEN(fieldinfo,1) IF i < ALEN(fieldinfo,1) lcUpdFields = lcUpdFields + fieldinfo(i,1) + "," lcUpdNames = lcUpdNames + fieldinfo(i,1)+ " " + "UDFields." + fieldinfo(i,1) + "," ELSE lcUpdFields = lcUpdFields + fieldinfo(i,1) lcUpdNames = lcUpdNames + fieldinfo(i,1)+ " " + "UDFields." + fieldinfo(i,1) ENDIF ENDFOR *** Set Tables property (Table for INSERT, UPDATE or DELETE) CURSORSETPROP( "TABLES", "ITCR42KDAT.UDFields", lcCursor ) *** Key Field(Key field for WHERE clause) CURSORSETPROP( "KEYFIELDLIST", "idnumber", lcCursor ) *** Updateable Field List (Fields which are updatable) CURSORSETPROP( "UPDATABLEFIELDLIST", lcUpdFields, lcCursor ) *** UpdateNameList (Back-end table name for each cursor field ) CURSORSETPROP( "UPDATENAMELIST", lcUpdNames ,lcCursor ) *** Set Where Type and Send update flag CURSORSETPROP( "WHERETYPE", 1, lcCursor ) CURSORSETPROP( "SENDUPDATES", .T., lcCursor ) *** Also set the Buffer/Locking Mode to Table/Optimistic CURSORSETPROP( "Buffering", 5, lcCursor ) *** Update the display BROWSE lnRes = .oCon.CloseConn(.nCon) ELSE MESSAGEBOX('SPT query failed to connect',0,'') ENDIF ENDWITHWhat am I doing wrong? The "lcCursor" does have data in it when I browse and I have selected the cursor also right before I build the update field list.