Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter Update Question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
CursorAdapter Update Question
Miscellaneous
Thread ID:
01015988
Message ID:
01015988
Views:
62
My cursoradapter class returns a JOIN of 2 table. I make a change
to 1 record and call TABLEUPDATE(). The CA is updating ALL records
on the LEFT and the correct record on the RIGHT.

Anyone know what I'm doing wrong? Here's my code:
CLOSE DATABASES ALL

LOCAL bRetVal, cDataPath
cDataPath = ADDBS(SYS(5) + SYS(2003))

SELECT 0
USE d:\projects\testdata\smts\bspotln ALIAS lines

SELECT 0
USE d:\projects\testdata\smts\bspotdt ALIAS details


oCA = CREATEOBJECT("CursorAdapter")

WITH oCA

	.Alias              = "Joined"
	.CursorSchema 			= "docid n(10,0),boid n(10,0),boidsml c(8,0),boidbase n(10,0),rectype c(1,0),docid2 n(10,0),boidbase2 n(10,0),boidsml2 c(8,0),dtid n(8,0),rectype2 c(1,0)"
	.DataSourceType			= "Native"
	.KeyFieldList 			= "BoId, DtId"
	.SelectCmd					= "select lines.docid, lines.boid, lines.boidsml, lines.boidbase, lines.rectype," +;
												"details.docid, details.boidbase, details.boidsml, details.dtid, details.rectype"+;
												  " from lines " +;
												  " join details on " +;
												  	"lines.boidbase = details.boidbase "+;
													"where lines.boid = 1097974"
	.Tables 						= "lines,details"
	.UpdatableFieldList = "docid,boid,boidsml,boidbase,rectype,docid2,boidbase2,boidsml2,dtid,rectype2"
	.UpdateNameList 		= "docid lines.docid,boid lines.boid,boidsml lines.boidsml,boidbase lines.boidbase,rectype lines.rectype,docid2 details.docid,boidbase2 details.boidbase,boidsml2 details.boidsml,dtid details.dtid,rectype2 details.rectype"


	** Get the data
	bRetVal = .CursorFill(.T.)

	IF bRetVal
		
		** Make changes
		CURSORSETPROP("Buffering", 5)
		REPLACE RecType WITH "Z", RecType2 WITH "Z" NEXT 1
		BROWSE
	
		** Save changes
		bRetVal = TABLEUPDATE()

		IF NOT bRetVal
			AERROR(aErrInfo)		
			MESSAGEBOX(TRANSFORM(aErrInfo[1]) + " " + aErrInfo[2],48, "Error")
		ENDIF
	
	ELSE
		AERROR(aErrInfo)		
		MESSAGEBOX(TRANSFORM(aErrInfo[1]) + " " + aErrInfo[2],48, "Error")
	ENDIF

ENDWITH
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Reply
Map
View

Click here to load this message in the networking platform