Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Practice on Refresh Grid with Data
Message
From
10/07/2020 12:07:50
 
 
To
10/07/2020 09:21:58
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01675136
Message ID:
01675139
Views:
95
Likes (1)
>>Hi!
>>
>>In our big and Old VFP9 Application we Read data from SQL Server via SQLExec(), and show the Data in VFP – Grid.
>>Sometimes we have to Reload the Data and since Years this is done in this sequence:
>>- Reload the Data (sqlexec() ) into the same named Cursor as before.
>>- Remove the Grid (oGrid.release() )
>>- Create an New Grid Instance (newobject() )
>>And, also since years, we fight against C5 Errors…
>>
>>This time I Reviewed this refresh-code and I asked me: Is this the right Order? Shouldn’t it be
>>- Remove the Grid
>>- Reload the Data
>>- Create the Grid
>>?
>>
>>What do you think? May this be a c5 Risky Code?
>>
>>How do you do this?
>>
>>Happy to hear your opinion
>
>I am doing the following for years without problems:
>Set Grid.Recordsource = ""
>Reload Data
>Reload Grid
>
>The Reload Grid is a function in the grid custom class that sets all columns based on properties, which define the columns, headers and sizes of all columns.

You might also want to check to make sure you're running afoul problems associated with WITH ... ENDWITH construct -- in particular you have to be careful not to "jump out" of a WITH .. ENDWITH context into a "parent" context (i.e. avoid using RETURN, EXIT or LOOP inside WITH ... ENDWITH if it means forcing an exit out of the WITH .. ENDWITH context). The problem of doing this isn't as acute in VFP9 as it was with older versions of VFP, but the problem does appear to exist.

Another thing I do recall that you needed to do in earlier versions of VFP was to use SYS(3050) to reduce the amount of memory used by VFP -- apparently the memory manager "gets sloppy" when more than 1GB of RAM is available and you start getting memory leaks which typically results in progressively decreasing performance and an occasional C5 error (which would indicate memory corruption) - especially when you've got the software running for an extended period of time.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform