Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter with SQL and parameter
Message
From
22/09/2004 15:52:52
 
 
To
22/09/2004 15:35:39
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00944961
Message ID:
00945189
Views:
43
>Yes this seems nice too, but I need the ability to .CursorRefresh() because the parameter can be changed to whatever the user picks.
>

So, what seems to be the problem?
CLOSE DATABASES ALL 
CLEAR

customerid='ALFKI'

LOCAL oCA as CursorAdapter

oCA=CREATEOBJECT("CursorAdapter")
oCA.SelectCmd="select * from Northwind..Orders where customerID = ?m.customerid"

?"ODBC"
oCA.DataSourceType="ODBC"
oCA.DataSource=SQLCONNECT("localServer")

IF oCA.DataSource<1
	?"Failed to connect."
ELSE
	?oCA.CursorFill()
	LIST
	
	customerid='HILAA'
	
	oCA.CursorRefresh()
	LIST

	USE
	SQLDISCONNECT(oCA.DataSource)
ENDIF
You can use object property instead of memvar. This is an example with ADO:
CLOSE DATABASES ALL 
CLEAR

customerid='ALFKI'

LOCAL oCA as CursorAdapter

oCA=CREATEOBJECT("CursorAdapter")
oCA.AddProperty("customerid",'ALFKI')
oCA.SelectCmd="select * from Northwind..Orders where customerID = ?this.customerid"

?"ADO"

LOCAL oConn as ADODB.Connection, oRS as ADODB.Recordset, oCom as ADODB.Command

oConn=CREATEOBJECT("ADODB.Connection")
oConn.Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=(local)")

oRS = CREATEOBJECT("Adodb.RecordSet")
oRS.ActiveConnection = oConn

oCom = CREATEOBJECT("Adodb.Command")
oCom.ActiveConnection = oConn

oCA.DataSourceType="ADO"
oCA.DataSource=oRS

?oCA.CursorFill(,,,oCom)
LIST

oCA.customerid='HILAA'
	
oCA.CursorRefresh()
LIST

USE
Thanks,
Aleksey.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform