I just realized that SqlCeConnection
and SqlCeCommand
objects timeout properties are readonly with default value set to 0. Does this mean queries to SqlCe database never timeout?
Asked
Active
Viewed 1,153 times
0

rageit
- 3,513
- 1
- 26
- 38
1 Answers
2
No they do timeout, you can define the timeout in connection string like this
SqlCeConnection conn = new SqlCeConnection();
conn.ConnectionString = "Persist Security Info=False; Data Source = Northwind.sdf;" +
"Password = <password>; server=mySQLServer;Connect Timeout=30";
This is whay MSDN has to say. ConnectionTimeout Property is the time (in seconds) to wait for a connection to open. The value is always 0 in SQL Server Compact as it is readonly.

Ehsan
- 31,833
- 6
- 56
- 65
-
A question that pops up is that if the connection string can be defined with the timeout value then why isn't the `ConnectionTimeout` property set internally with the timeout value from the connection string. Why is it always 0? – rageit Aug 07 '13 at 19:00
-
@rageit very valid question, but i guess Eric Lippert can answer that – Ehsan Aug 07 '13 at 19:04