Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter Issues
Message
De
27/08/2003 01:17:31
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00823597
Message ID:
00823686
Vues:
24
>Also see:
>
>CursorAdapter Bug Repro Code... Thread #762796 Message #762796
>
>for my repro code.

Hi Mark and Jayesh,

It happens because CursorAdapter uses Parameters.Refresh() method to populate Parameters collection. If Refresh() succeeds, CursorAdapter assumes that collection is ready to use.


The following code doesn't use CursorAdapter at all, but has the same problem:
CLOSE DATABASES all
clear

oCon=CREATEOBJECT("ADODB.Connection")
oCon.Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;"+;
			"Persist Security Info=False;Initial Catalog=Northwind;Data Source=(local)")
oCon.Execute("SET ANSI_PADDING OFF")			
oCom=CREATEOBJECT("ADODB.Command")
oCom.ActiveConnection=oCon
oCom.CommandText="select * from Customers where CustomerID like ?"

?"Try datatype provided by oCom.Parameters.Refresh()"
oCom.Parameters.Refresh()
?oCom.Parameters.Item(0).Type,oCom.Parameters.Item(0).Size
oCom.Parameters.Item(0).Value="M%"
oRS=CREATEOBJECT("ADODB.Recordset")
oRS.Open(oCom,,,-1)
count=PrintRecordset(oRS) 
?"Amount of records", count 
oRS.Close()
?
? "Change the data type to adVarChar."
oCom.Parameters.Item(0).Type=200 && adVarChar
oRS.Open(oCom,,,-1)
count=PrintRecordset(oRS) 
?"Amount of records", count 

return


FUNCTION PrintRecordset (oRS as ADODB.Recordset)
	LOCAL count
	count=0
	DO WHILE !oRS.EOF
		?oRS.Fields.Item(0).Value 
		oRS.MoveNext()
		count = count + 1 
	ENDDO
	
	RETURN count
ENDFUNC 
Thus, it is not a VFP BUG, however, I do understand that this doesn't really matter for a developer who is facing the problem.

Thanks,
Aleksey.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform