Solved

Re-connecting to a Database and table after the connection is dropped

Posted on 1998-09-29
1
140 Views
Last Modified: 2011-08-18
Hello All !  I have a Delphi 1.0 app that is running against SQL-AnyWhere 5.5.0.4 Build 1867. The database does not have the -i option set which means the default for that option is in effect: that is, connections that are idle for four hours are disconnected.

But, lets say my user clicks the "refresh" button, five hours after the app has been idle.  Now, they get an error message that says:

"General SQL error [Sybase][ODBC Driver]
Connection not open;not connected to database"

Instead of getting/seeing that message, I want to handle the error and re-connect to the database and tables for the user without them knowing it or seeing it, and I want to refresh the app's data.  Can anyone offer advice?

Everett
0
Comment
Question by:ecrockett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
belgianbasman earned 100 total points
ID: 1341110
Looks like a basic exception handling problem to me.

in the onClick event handler of the refresh button, put the following:

try
   begin
//          Display;
   end;
Except on EDatabaseError do
   begin
//           Disconnect;
//           Connect;
//           Display;
   end;
END;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help on project with Soap 10 70
Print Graphic and Text to Epson TM-T88v 12 560
Controlled Assessment GCSE - desperate help needed 4 122
Delphi Firemonkey : user drawing in window 3 58
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question