C Access SqlServer Set Link Timeout Method

  • 2021-07-01 08:07:53
  • OfStack

This article example shows how C # accesses SqlServer to set the link timeout. Share it for your reference. The specific implementation method is as follows:

The following code sets the timeout to 60 seconds, and the default is 30 seconds


using (connection) {
  SqlCommand sqlcommand = connection.CreateCommand();
  sqlcommand.CommandTimeout = 60;
  // The default time is  30  Seconds 
  sqlcommand.CommandText = sqlText;
  ... 

I hope this article is helpful to everyone's C # programming.


Related articles: