我正在尝试覆盖默认的SqlConnection
超时时间,但出现错误提示:
属性或索引器因为只读无法分配。
是否有解决方法?
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();
}
}