Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter with SQL and parameter
Message
De
22/09/2004 15:52:52
 
 
À
22/09/2004 15:35:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00944961
Message ID:
00945189
Vues:
41
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform