troubleshooting Question

How do I check connection status in data bound forms?

Avatar of sonetinc
sonetinc asked on
.NET ProgrammingC#
7 Comments1 Solution307 ViewsLast Modified:
I have a simple form in my .Net application: form with a combobox and textboxes bound to a SQL database. The user can browse data records by changing the combobox selection and print the select record.

When the application is idle for a longer period the DB drops the connection. Later when the user comes back and makes a quick selection change the data is not being supplied quickly enough to the text boxes. Clicking the print button, the application sends data from the previously selected record to the print function without any error messages (although at that time the combobox has different ID selected (before the DB connection is reestablished).

How can I check the DB connection status and catch this error?

The textboxes are bound with the following command:

textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.credentialsBindingSource, "FirstName", true));

Any help is greatly appreciated…

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros