Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid - CursorAdapter
Message
From
02/12/2005 13:19:07
 
 
To
02/12/2005 00:23:35
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01073232
Message ID:
01074319
Views:
26
Sarosh,

I see the same problem when I run your code, but in my use of CursorAdapter against SQL Server tables (DataSourceType="ODBC"), CursorRefresh does NOT create a new cursor.

The problem looks like it is just when working with NATIVE VFP tables as the DataSource -- most of my work with CAs has been with SQL Server. I'll let you know if I come across any solution.

>It looks like CursorFill() and CursorRefresh() both re-create the cursor (temp dbf file). Am I doing something wrong here?
>
>
>Local loCustomer as CursorAdapter
>Local lcCustomerID as String && It will do for this repro code.
>Local lcDBF1 as String
>Local lcDBF2 as String
>Local lcDBF3 as String
>
>Clear
>Set Talk Off
>Set Exact On
>Close All
>Clear All
>*--
>Open Database Home(2)+"Northwind\Northwind"
>*--
>loCustomer = CreateObject("Cursoradapter")
>*--
>With loCustomer as CursorAdapter
>
>	.DataSourceType = "NATIVE"
>	.Tables = "Customers"
>	.KeyFieldList = "customerid"
>	.SelectCmd = "select * from customers where customerid = ?lcCustomerID"
>
>	lcCustomerID = "ALFKI"
>	? "1] CursorFill()", .CursorFill()
>	lcDBF1 = Dbf()
>	? lcDBF1, lcCustomerID, Alltrim(companyname)
>	*Browse
>
>	lcCustomerID = "OCEAN"
>	? "2] CursorRefresh()", .CursorRefresh()
>	lcDBF2 = Dbf()
>	? lcDBF2, lcCustomerID, Alltrim(companyname)
>	*Browse
>
>	lcCustomerID = "GREAL"
>	? "3] CursorRefresh()", .CursorRefresh()
>	lcDBF3 = Dbf()
>	? lcDBF3, lcCustomerID, Alltrim(companyname)
>	*Browse
>
>	?
>	? "Is lcDBF2 = lcDBF3? : ", Iif(lcDBF2 == lcDBF3, "Yes", "No")
>
>EndWith
>*--
>Close All
>Return
>*--
>
>
>
>Sarosh
>
>>Sarosh,
>>
>>>In the grdCustomer's AfterRowColChange Event I have tried calling the cursoradapter's CursorRefresh() and CursorFill() -ThisForm.DataEnvironment.cadOrders.CursorRefresh()/CursorFill() methods and the grid looses all its column settings because a new underlying cursor gets created each time I call CursorRefresh() or CursorFill().
>>
>>You should call only CursorRefresh(), which will not destroy and re-create the cursor and should keep all your settings for the grid columns. If you call CursorFill(), you will create a new cursor for sure. CursorRefresh just repeats the last CUrsorFill() selectcmd, but without tearing down the cursor.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Reply
Map
View

Click here to load this message in the networking platform