Remote access to mobile databases
Home | Products | Buy | Support | Downloads | Contacts | Forum | Blog Search

open all | close all

DesktopSqlCe FAQ

What are Pipe timeouts and what can I do about them?

The Pipe object connects your application (the client) to the server code either on the local PC or on a remote device. The timeout works as a safety valve for situations where the client code is waiting for a reply from the server. If the server stops for some reason, the client can detect this and take appropriate measures. DesktopSqlCe will throw an exception when a timeout occurs, but you can prevent this as you can see below:

Handling timeouts can be done in two ways:

  1. Increase the default timeout from 10 seconds (value of 10000 milliseconds) to something that is more appropriate to your application. The timeout can be set through the Pipe.Timeout property (see below). This is a static approach and may fail if you execute a very slow query, for instance. This approach works best in tandem with the second:
  2. Handle the Pipe.PipeTimeoutEventHandler event. This event is raised before the exception is thrown and you can use the event arguments to prevent the exception from being thrown (set the Cancel property to true). The timeout period can be extended and you can use this opportunity to inform the user.

The Pipe object can be easily accessed through the SqlCeConnection.Pipe property.