.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

how to set the connection time out in the connection string?

Posted By: Deco     Posted Date: September 28, 2010    Points:2   Category :ASP.Net
give me a sample connection string where connection timeout is used.

what is the default value for defualt connection time out?

Responses
Author: Jean Paul             
Posted Date: September 28, 2010     Points: 5   

You can use the connection string to specify timeout in seconds.

Example:

SqlConnection connection = new SqlConnection(@"Data Source=localhost\sqlexpress; Initial Catalog=master; Integrated Security=true; Connect Timeout=2");

connection.Open();

// Check the ConnectionTimeout property to ensure 2 seconds was set
int timeout = connection.ConnectionTimeout; // This is a getter only property

Jean Paul http://jeanpaulva.com/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend