Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CA RecordRefresh()
Message
 
 
To
08/04/2021 15:50:34
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01679671
Message ID:
01679694
Views:
42
UPDATE: Never mind my question. I see from the VFP help that this function will simply load all handles. And in my case it will be one. Thank you.

First, thank you for the message.
Question: What is the aSqlhndls? In my app there is only one SQL Server handle which is created at the top of the application. Then this handle is used in all connections and all CA objects.
Do you have multiple handles in your app?

>Years ago I got the following code from the VFP team (I forgot the name of the member)
>
>
>
>			ASQLHANDLES(aSqlhndls)
>			FOR EACH nOdbchdbc IN aSqlhndls
>				=SQLIDLEDISCONNECT(nOdbchdbc)
>			ENDFOR
>
>
>
>Each time a connection fails, you can call a routine with these statements and it will reconnect upon the next usage of the connection.
>
>Our product calls a SQL statement about every 5 - 15 seconds. If a connection fails, it most likely fails on that SQL statement and calling the statements above will revive the connection without any problem going forward.
>
>It works perfectly for us. I can close my laptop at work, travel home, connect to our wifi and VPN and continue working without a problem as the database is in the UK.
>
>Walter,
>
>
>
>
>
>
>
>
>>Hi,
>>
>>I have a code that calls CA_OBJECT.RecordRefresh() when qvuser navigates through the records on the form.
>>Most times it works. But once in a while the call fails and the error is "Communication link failure" I suspect that it happens when a user leaves the desktop for some time (lunch, coffee break, etc.) and the application loses connection to the SQL Server.
>>I am thinking of a couple of ways to address this issue:
>>1. I can add a parameter, say 5, to the .RecordRefresh(5). Which, I understand from the VFP help will attempt to refresh for 5 seconds. My question here, do you know, if the refresh works right away, will VFP still "stay" on 5 seconds delay?
>>2. I can check the connection before each call to .RecordRefresh() using this code:
>>
>>	IF SQLEXEC( oApp.conn_handle, "SELECT CAST(1 as bit) As Test", "crsTestConnection")  < 0
>>*-.... deal with this
>>
>> But I am concerned that this will slow down the navigation for all cases.
>>
>>TIA for any thoughts or/and input.
>>
>>UPDATE. I misread the 1 (above). The Parameter is the number of records, not number of seconds.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform