Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Annoying cursoradapter
Message
From
26/10/2004 06:37:25
 
 
To
25/10/2004 14:45:46
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00954292
Message ID:
00954484
Views:
11
Thanks Aleksey ! This was very helpful and allowed me to make my updatable CursorAdapter work, even if not in the simplest way. It doesn't use the update functionalities of the ADO RecordSet :
	loCursorAdapter=CREATEOBJECT("CursorAdapter")
	lcSql="SELECT * FROM test ORDER BY testid"
	lcSqlUpdate="UPDATE test SET teststring=?adapter.teststring WHERE ";
	+"testid=?adapter.testid AND teststring=?OLDVAL('teststring','adapter')"
	WITH loCursorAdapter
		.Alias="adapter"
		.DataSourceType="ADO"
		.DataSource=CREATEOBJECT("ADODB.RecordSet")
		.UpdateCmdDataSourceType="ADO"
		.UpdateCmd=lcSqlUpdate
		.DataSource.ActiveConnection=loConn
	ENDWITH
	SET MULTILOCKS ON
	loCommand=CREATEOBJECT("ADODB.Command")
	WITH loCommand
		.CommandText=lcSql
		.CommandType=1
		.ActiveConnection=loConn
	ENDWITH
	loUpdateCommand=CREATEOBJECT("ADODB.Command")
	WITH loUpdateCommand
		.CommandType=1
		.ActiveConnection=loConn
	ENDWITH
	loCursorAdapter.UpdateCmdDataSource=loUpdateCommand
	loRecordSet=CREATEOBJECT("ADODB.RecordSet")
	WITH loRecordSet
		.CursorLocation=3
		.CursorType=1
		.LockType=3
		.Source=loCommand
		.Open()
	ENDWITH
	THIS.oCursorAdapter.DataSource.ActiveConnection=THIS.oConnection
	loCursorAdapter.CursorFill(.F.,.F.,0,loRecordSet)
	LOCATE FOR testid=4
	REPLACE teststring WITH "test5"
	LOCATE FOR testid=3
	REPLACE teststring WITH "test6"
	IF TABLEUPDATE()
		? "TABLEUPDATE"
	ENDIF
	loRecordSet.Close()
	loConn.Close()
	USE
Previous
Reply
Map
View

Click here to load this message in the networking platform