Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reconnect to SQL Server and CursorAdapter
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Reconnect to SQL Server and CursorAdapter
Miscellaneous
Thread ID:
01641888
Message ID:
01641888
Views:
69
Hi,

I am using CursorAdapter for updating tables in SQL Server. It works very well. Except ..

When user does not use the application, my understanding is that the application loses connection to the SQL Server (times out). So what I do is check if the connection handle to the SQL server is still valid, and if not reconnecting to the SQL server. This does not really help with CursorAdapter.

Let me explainon simple example. When user opens a form, the VFP application fills a cursor adapter for a table (say, MyTable). So user can see the values of some record in the CA on the screen. So far, fine. Then user goes to lunch or whatever. Comes back after an hour or 30 minutes. User clicks on Add Record button. The application checks if the SQL Server connection handle is still valid. If not, reconnect to the SQL Server. Then the application adds a record to the Cursor Adapter cursor and then call TableUpdate().
Tableupdate() Fail! My understanding is that it fails because some property of the CursorAdapter has the SQL Server connection handle - before the time out. And even though I/app reconnect to the SQL Server (before Tableupdate()), the "old" handle is invalid. And therefore, Tableupdate() fails.

Which property of the CA should I update with the new SQL Server connection handle, when reconnecting to the SQL Server, so that the tableupdate() would not fail?

TIA

UPDATE. I found a property CursorAdapter.DataSource which is set to the SQL Server connection handle. So this must be it that I need to update. I just need to test it by forcing a SQL connection time out.
"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
Reply
Map
View

Click here to load this message in the networking platform