Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter Update Problem
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01016803
Message ID:
01016896
Views:
17
Ok, well I guess I'm not sure what the correct functionality should be.

Here's my code:
CLOSE DATABASES ALL

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

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", 3)
		BROWSE
	
		** Save changes
		bRetVal = TABLEUPDATE()

		BROWSE

		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
>>I created a join with a cursor adapter. I then changed values on the first
>>record, on fields from both tables, and when I did a TABLEUPDATE(), the field
>>from the Left table was changed for ALL records, and the Right table was ok.
>>
>>Anyone know what I'm doing wrong?
>>
>>Thanks
>
>What exactly do you want updated? The "right" table only? The key to this is to imagine what kind of SQL VFP is going to generate for you for the update based on the values of the following properties: Tables, KeyFieldList, UpdatableFieldList and UpdateNameList. If you do not want records in the "Left" table updated, leave that information out of those properties. If my assumptions are wrong, just post the values for those properties and what/how you want your data updated.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Reply
Map
View

Click here to load this message in the networking platform