Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter Issues
Message
From
27/08/2003 01:17:31
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00823597
Message ID:
00823686
Views:
25
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform