I am building a database application which runs on laptops in vehicles. The idea is that the user fills out a form while on the road, it is cached locally, and then sent to the DB (MySQL) over the wireless network when the user returns to the site.

I have the program try to connect to the server every 10 seconds.

The problem I am having is:

1) when the vehicle leaves the site, with the program running, it thinks it can connect (and tries, and errors) even if there is no network connection

2) if I start the program in the vehicle while offsite, and then return and the network connects, the program still sees no network and won't connect.

I am using Microsoft ODBC Data Control and MySQL Connector/ODBC. Is this a problem with the drivers, or do I just need to call some Windows function to tell if the network is connected? How do I do this?

Any help is greatly appreciated.

Thanks,
Jason