Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter and Oracle stored procedures
Message
From
28/10/2004 12:48:39
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
CursorAdapter and Oracle stored procedures
Miscellaneous
Thread ID:
00955370
Message ID:
00955370
Views:
100
Hello,

I am trying to use updatable CursorAdapters with ADO, accessing either a VFP or an Oracle database.
When accessing VFP, about everything is all right, but when accessing Oracle, I don't know how to set the UpdateCmd to an Oracle stored procedure, even without any parameter (of course I will need parameters also). I found a lot of examples using SQL Server SPs, but none with Oracle.
Here is a sample code which works against a VFP database, but not against Oracle. The same code with loUpdateCommand.CommandType=1 and a parametered SQL query as lcSqlUpdate works. What am I missing ?
(loConn is a valid open Oracle connection)
	loCursorAdapter=CREATEOBJECT("CursorAdapter")
	lcSql="SELECT * FROM test ORDER BY testid"
	lcSqlUpdate="test_updateline4(?teststring)"
	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=4
		.ActiveConnection=loConn
	ENDWITH
	loCursorAdapter.UpdateCmdDataSource=loUpdateCommand
	loRecordSet=CREATEOBJECT("ADODB.RecordSet")
	WITH loRecordSet
		.CursorLocation=3
		.CursorType=3
		.LockType=4
		.Source=loCommand
		.Open()
	ENDWITH
	THIS.oCursorAdapter.DataSource.ActiveConnection=THIS.oConnection
	loCursorAdapter.CursorFill(.F.,.F.,0,loRecordSet)
	SCAN 
		message1=TYPE("testid")
		? message1
		message2=STR(testid)
		? message2
	ENDSCAN
	LOCATE FOR testid=3
	REPLACE teststring WITH "test5"
	IF TABLEUPDATE(.T.)
		? "TABLEUPDATE"
		? _TALLY
		? teststring
	ELSE
		result=TABLEREVERT(.T.)
		? "TABLEREVERT"
		? result
		SET PROCEDURE TO error.prg
		show_aerror()
	ENDIF	
	USE
	loRecordSet.Close()
	loConn.Close() 
Next
Reply
Map
View

Click here to load this message in the networking platform