Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SPT error when setting CURSORSETPROP
Message
 
À
14/05/2003 13:29:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00787810
Message ID:
00788329
Vues:
29
I tried it out and it didn't work. I revised the code again as follows:
WITH thisform
	LOCAL a,g,x,lcUpdFields,lcUpdNames,defdrive
	IF ISNULL(.oCon)
		.oCon = NEWOBJECT('ConMgr','conmgr.prg')
	ENDIF 
	defdrive = SYS(5)
	DO CASE 
		CASE defdrive = 'H:'
			.nCon = .oCon.OpenConn('itc_H_drive')
		
		CASE defdrive = 'C:'
			.nCon = .oCon.OpenConn('itc_C_drive')
		
		CASE defdrive = 'L:'
			.nCon = .oCon.OpenConn('itc_L_drive')
			
	ENDCASE 
	IF .nCon < 1
		MESSAGEBOX('connection failed, aborting cursor update,16, major waaaaaahhhhh!!!')
		RETURN .f.
	ENDIF 
	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
		brow
		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)
	    lnRes = CURSORSETPROP( "TABLES", "ITCR42KDAT.UDFields", "lcCursor" )
	    *** Key Field(Key field for WHERE clause)
	    lnRes = CURSORSETPROP( "KEYFIELDLIST", "idnumber", "lcCursor" )
	    *** Updateable Field List (Fields which are updatable)
	    lnRes = CURSORSETPROP( "UPDATABLEFIELDLIST", lcUpdFields, "lcCursor" )
	    *** UpdateNameList (Back-end table name for each cursor field )
	    lnRes = CURSORSETPROP( "UPDATENAMELIST", lcUpdNames ,"lcCursor" )
	    *** Set Where Type and Send update flag
	    lnRes = CURSORSETPROP( "WHERETYPE", 1, "lcCursor" )
	    lnRes = CURSORSETPROP( "SENDUPDATES", .T., "lcCursor" )
	    *** Also set the Buffer/Locking Mode to Table/Optimistic
	    lnRes = CURSORSETPROP( "Buffering", 5, "lcCursor" )
	    *** Update the display
	    .counter = .counter + 1
	   
	    v = (STR(.counter))
	    UPDATE lcCursor set lcCursor.firstname = v WHERE lcCursor.Ssno = (g)
	    z = TABLEUPDATE(.t.,.t.,"lcCursor")
	    AERROR(arrtest)
		lnRes = .oCon.CloseConn(.nCon)
	ELSE 
		MESSAGEBOX('SPT query failed to connect',0,'')
	ENDIF 
ENDWITH
Now my tableupdate keeps getting a .f. The aerror tells me "1491 No update tables are specified. Use table property of the cursor". I thought that I aready pointed to table with:
 cursorsetprop("tables","ITCR42DAT.UDFIelds","lcCursor")
I'm missing something here again?

Thanks
Nick Patel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform