KeithBraud
n00b
- Joined
- Jan 17, 2013
- Messages
- 55
I am trying to override the default SQL Connection timeout of 15 seconds and am getting an error saying that the
"Property or indexer cannot be assigned because it is read only."
Is there a way around this?
"Property or indexer cannot be assigned because it is read only."
Is there a way around this?
Code:
using (SqlConnection connection = new SqlConnection(Database.EstimatorConnection))
{
connection.Open();
using (SqlCommand command = connection.CreateCommand())
{
command.CommandType = CommandType.StoredProcedure;
connection.ConnectionTimeout = 180; // This is not working
command.CommandText = "sproc_StoreData";
command.Parameters.AddWithValue("@TaskPlanID", order.Projects[0].TaskPlanID);
command.Parameters.AddWithValue("@AsOfDate", order.IncurDate);
command.ExecuteNonQuery();
}
}