Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursoradapter and tableupdate
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Cursoradapter and tableupdate
Miscellaneous
Thread ID:
01260455
Message ID:
01260455
Views:
69
Hi all

I need to update some SQL Server tables and remembered the cursoradapter.
Using the CA builder I got a cursoradapter and I'm able to fill the cursor, browse, make changes and those changes are sent and update my SQL Server test table.
So far so good.

But the behavior I want is to be able to make changes in the local cursor BUT send the updates only after a Tableupdate(). Not automatically as it is happening now.

How do I do that?
Here is the code from the CA builder, many thanks in advance,
PUBLIC oCustomerLevel
oCustomerLevel = CREATEOBJECT("cacustomerlevel")
oCustomerLevel.CursorFill()
Browse
*-- Make some changes here
*-- Those are sent inmediately to the SQL Server table!
*-- I want to 'push' the changes with tableupdate() not sending them automatically.
**************************************************
*-- Class:        cacustomerlevel (c:\documents and settings\mzambrano\my documents\campuscare 2007\vfpcode\aspdotnetstorefront.vcx)
*-- ParentClass:  cursoradapter
*-- BaseClass:    cursoradapter
*-- Time Stamp:   10/11/07 05:47:00 PM
*
DEFINE CLASS cacustomerlevel AS cursoradapter


	Tag = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=XXXXX;Data Source=YYYY;"
	Height = 22
	Width = 23
	SelectCmd = "select * from CustomerLevel"
	CursorSchema = "CUSTOMERLEVELID I, CUSTOMERLEVELGUID C(38), NAME M, LEVELDISCOUNTPERCENT Y, " + ;
		"LEVELDISCOUNTAMOUNT Y, LEVELHASFREESHIPPING I, LEVELALLOWSQUANTITYDISCOUNTS I, LEVELHASNOTAX I," + ;
		" LEVELALLOWSCOUPONS I, LEVELDISCOUNTSAPPLYTOEXTENDEDPRICES I, LEVELALLOWSPO I, DISPLAYORDER I," + ;
		" PARENTCUSTOMERLEVELID I, SENAME C(100), EXTENSIONDATA M, DELETED I, CREATEDON T, SKINID I, TEMPLATENAME C(50)"
	Alias = "curcustomerlevel"
	DataSourceType = "ADO"
	Flags = 0
	FetchSize = -1
	KeyFieldList = "CUSTOMERLEVELID"
	Tables = "CustomerLevel"
	
	
	
	UpdatableFieldList = "CUSTOMERLEVELGUID, NAME, LEVELDISCOUNTPERCENT, LEVELDISCOUNTAMOUNT, LEVELHASFREESHIPPING,"+;
	" LEVELALLOWSQUANTITYDISCOUNTS, LEVELHASNOTAX, LEVELALLOWSCOUPONS, LEVELDISCOUNTSAPPLYTOEXTENDEDPRICES," + ;
	" LEVELALLOWSPO, DISPLAYORDER, PARENTCUSTOMERLEVELID, SENAME, EXTENSIONDATA, DELETED, CREATEDON, SKINID," + ;
	" TEMPLATENAME"
	
	UpdateNameList = "CUSTOMERLEVELID CustomerLevel.CUSTOMERLEVELID, CUSTOMERLEVELGUID CustomerLevel.CUSTOMERLEVELGUID, " + ;
		"NAME CustomerLevel.NAME, LEVELDISCOUNTPERCENT CustomerLevel.LEVELDISCOUNTPERCENT, " + ;
		"LEVELDISCOUNTAMOUNT CustomerLevel.LEVELDISCOUNTAMOUNT, LEVELHASFREESHIPPING " + ;
		"CustomerLevel.LEVELHASFREESHIPPING, LEVELALLOWSQUANTITYDISCOUNTS " + ;
		"CustomerLevel.LEVELALLOWSQUANTITYDISCOUNTS, LEVELHASNOTAX CustomerLevel.LEVELHASNOTAX," + ;
		" LEVELALLOWSCOUPONS CustomerLevel.LEVELALLOWSCOUPONS, LEVELDISCOUNTSAPPLYTOEXTENDEDPRICES " + ;
		"CustomerLevel.LEVELDISCOUNTSAPPLYTOEXTENDEDPRICES, LEVELALLOWSPO CustomerLevel.LEVELALLOWSPO," + ;
		" DISPLAYORDER CustomerLevel.DISPLAYORDER, PARENTCUSTOMERLEVELID CustomerLevel.PARENTCUSTOMERLEVELID," + ;
		" SENAME CustomerLevel.SENAME, EXTENSIONDATA Address.EXTENSIONDATA, DELETED Address.DELETED, " + ;
		"CREATEDON Address.CREATEDON, SKINID CustomerLevel.SKINID, TEMPLATENAME CustomerLevel.TEMPLATENAME"
		
	Name = "cacustomerlevel"


	PROCEDURE Init
		*** Setup code: DO NOT REMOVE
		local llReturn
		do case
			case not pemstatus(This, '__VFPSetup', 5)
				This.AddProperty('__VFPSetup', 0)
			case This.__VFPSetup = 1
				This.__VFPSetup = 2
			case This.__VFPSetup = 2
				This.__VFPSetup = 0
				return
		endcase
		set multilocks on
		llReturn = dodefault()
		*** End of Setup code: DO NOT REMOVE
		*** Select connection code: DO NOT REMOVE

		local loConnDataSource
		loConnDataSource = createobject('ADODB.Connection')
		***<DataSource>
		loConnDataSource.ConnectionString = [Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;In] + ;
			[itial Catalog=AspDotNetStorefront;Data Source=mossfarm;]
		***</DataSource>
		loConnDataSource.Open()
		This.DataSource = createobject('ADODB.RecordSet')
	
		THIS.DATASOURCE.CursorType			= 3  && adOpenStatic
		
		This.DataSource.CursorLocation   = 3  && adUseClient
		This.DataSource.LockType         = 3  && adLockOptimistic
		This.DataSource.ActiveConnection = loConnDataSource
		*** End of Select connection code: DO NOT REMOVE

		*** Setup code: DO NOT REMOVE
		if This.__VFPSetup = 1
			This.__VFPSetup = 2
		endif
		return llReturn
		*** End of Setup code: DO NOT REMOVE
	ENDPROC


	PROCEDURE AutoOpen
		*** Setup code: DO NOT REMOVE
		if not pemstatus(This, '__VFPSetup', 5)
			This.AddProperty('__VFPSetup', 1)
			This.Init()
		endif
		*** End of Setup code: DO NOT REMOVE
	ENDPROC


ENDDEFINE
*
*-- EndDefine: cacustomerlevel
**************************************************

...Y soy feliz, bien feliz, asi lo grito;
Mira, que el mundo sepa, que se sepa:
Soy feliz....                       

...And I'm happy, quite happy, so do I yell it;
Look, so the world knows it, so be known:
I'm happy...
 

Ismael Rivera "Oye cosita linda"
Next
Reply
Map
View

Click here to load this message in the networking platform