Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Annoying cursoradapter
Message
De
26/10/2004 06:37:25
 
 
À
25/10/2004 14:45:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Database:
Visual FoxPro
Divers
Thread ID:
00954292
Message ID:
00954484
Vues:
12
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform