C# OleDbConnection con set to timeout
问题 I have an app that queries an Access database and shows the data. I want the connection(con) to timeout after 2 minutes. Does anyone have any suggestions on how i can code this? this is what i have in the beginning OleDbConnection con; OleDbDataReader dr; OleDbCommand cmd; con.Open(); cmd = new OleDbCommand(str, con); dr = cmd.ExecuteReader(); Thank you 回答1: @Damith is close, but unfortunately the ConnectionTimeout property is read-only. You have to set the timeout in the connection string