SqlCommand.CommandTimeout Property (Microsoft.Data.SqlClient) (2024)

Table of Contents
Remarks Applies to

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

public: virtual property int CommandTimeout { int get(); void set(int value); };
public override int CommandTimeout { get; set; }
member this.CommandTimeout : int with get, set
Public Overrides Property CommandTimeout As Integer

Property Value

The time in seconds to wait for the command to execute. The default is 30 seconds.

Exceptions

Remarks

A value of 0 indicates no limit (an attempt to execute a command will wait indefinitely).

Note

The CommandTimeout property will be ignored during old-style asynchronous method calls such as BeginExecuteReader. It will be honored by the newer async methods such as ExecuteReaderAsync.

Note

This property is the cumulative time-out (for all network packets that are read during the invocation of a method) for all network reads during command execution or processing of the results. A time-out can still occur after the first row is returned, and does not include user processing time, only network read time.

For example, with a 30 second time out, if Read requires two network packets, then it has 30 seconds to read both network packets. If you call Read again, it will have another 30 seconds to read any data that it requires.

// <Snippet1>using System;using Microsoft.Data.SqlClient;public class A{ public static void Main() { string connectionString = "<Your-connection-string-here>"; // Wait for 5 second delay in the command string queryString = "waitfor delay '00:00:05'"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(queryString, connection); // Setting command timeout to 1 second command.CommandTimeout = 1; try { command.ExecuteNonQuery(); } catch (SqlException e) { Console.WriteLine("Got expected SqlException due to command timeout "); Console.WriteLine(e); } } }}// </Snippet1>

Applies to

SqlCommand.CommandTimeout Property (Microsoft.Data.SqlClient) (2024)
Top Articles
8-Hour workday calculator with break time and how to use it
How to Manage Income During Retirement
No Hard Feelings (2023) Tickets & Showtimes
Mcgeorge Academic Calendar
Skamania Lodge Groupon
Evil Dead Rise Showtimes Near Massena Movieplex
Chris wragge hi-res stock photography and images - Alamy
Craigslist Free Stuff Appleton Wisconsin
Teamexpress Login
Brutál jó vegán torta! – Kókusz-málna-csoki trió
Bc Hyundai Tupelo Ms
Walmart Windshield Wiper Blades
Otterbrook Goldens
Tcu Jaggaer
Procore Championship 2024 - PGA TOUR Golf Leaderboard | ESPN
Michael Shaara Books In Order - Books In Order
Dignity Nfuse
Niche Crime Rate
Pretend Newlyweds Nikubou Maranoshin
Lehmann's Power Equipment
Td Small Business Banking Login
라이키 유출
Hobby Stores Near Me Now
Georgia Cash 3 Midday-Lottery Results & Winning Numbers
Drug Test 35765N
Prot Pally Wrath Pre Patch
Busted Mugshots Paducah Ky
Bolly2Tolly Maari 2
Hobby Lobby Hours Parkersburg Wv
1636 Pokemon Fire Red U Squirrels Download
Craigslist Northern Minnesota
Ocala Craigslist Com
Nurofen 400mg Tabletten (24 stuks) | De Online Drogist
A Grade Ahead Reviews the Book vs. The Movie: Cloudy with a Chance of Meatballs - A Grade Ahead Blog
Roadtoutopiasweepstakes.con
Minecraft Jar Google Drive
Telegram update adds quote formatting and new linking options
Alpha Asher Chapter 130
Giovanna Ewbank Nua
814-747-6702
2Nd Corinthians 5 Nlt
Thothd Download
Brown launches digital hub to expand community, career exploration for students, alumni
Darkglass Electronics The Exponent 500 Test
Unit 11 Homework 3 Area Of Composite Figures
Joy Taylor Nip Slip
Christie Ileto Wedding
Parks And Rec Fantasy Football Names
Divisadero Florist
How to Find Mugshots: 11 Steps (with Pictures) - wikiHow
Unity Webgl Extreme Race
Latest Posts
Article information

Author: Carlyn Walter

Last Updated:

Views: 5869

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.