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
How to Stand Out to Potential Acting Agents
Costs of buying a property in France - iad Overseas
360 Training Alcohol Final Exam Answers
Routing Number 041203824
Skip The Games Norfolk Virginia
Free Robux Without Downloading Apps
Danielle Longet
Space Engineers Projector Orientation
Theycallmemissblue
Alejos Hut Henderson Tx
Operation Cleanup Schedule Fresno Ca
Scotchlas Funeral Home Obituaries
Nhl Tankathon Mock Draft
Acts 16 Nkjv
Quadcitiesdaily
Boscov's Bus Trips
Little Rock Skipthegames
R. Kelly Net Worth 2024: The King Of R&B's Rise And Fall
Seeking Arrangements Boston
Mythical Escapee Of Crete
Dei Ebill
1145 Barnett Drive
Nottingham Forest News Now
Hrconnect Kp Login
Evil Dead Rise Ending Explained
Past Weather by Zip Code - Data Table
Bj's Tires Near Me
Abga Gestation Calculator
De beste uitvaartdiensten die goede rituele diensten aanbieden voor de laatste rituelen
Orangetheory Northville Michigan
Domino's Delivery Pizza
Imperialism Flocabulary Quiz Answers
How to Draw a Sailboat: 7 Steps (with Pictures) - wikiHow
Search All of Craigslist: A Comprehensive Guide - First Republic Craigslist
Postgraduate | Student Recruitment
Former Employees
21 Alive Weather Team
Blackwolf Run Pro Shop
Poe Self Chill
Craigslist Com St Cloud Mn
Darkglass Electronics The Exponent 500 Test
Lorton Transfer Station
Learn4Good Job Posting
Devotion Showtimes Near Showplace Icon At Valley Fair
Take Me To The Closest Ups
UNC Charlotte Admission Requirements
Oak Hill, Blue Owl Lead Record Finastra Private Credit Loan
Home | General Store and Gas Station | Cressman's General Store | California
Peugeot-dealer Hedin Automotive: alles onder één dak | Hedin
Fahrpläne, Preise und Anbieter von Bookaway
Used Curio Cabinets For Sale Near Me
Les BABAS EXOTIQUES façon Amaury Guichon
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.