Hello everyone,
I am using VSTS 2008 + ADO.Net + C# + .Net 3.5 + SQL Server 2008. I am using ADO.Net at client side to connect to database server to execute a store procedure, then return result from the store procedure.
Here is my code. I have two issues about timeout,
If I do not explicitly set any timeout related settings, for the connection to database server, are there any timeout settings (e.g. if can not connect to database server for some default amount of time, there will be some timeout exception?)?
If I do not explicitly set any timeout related settings, for the execution of the store procedure, are there any timeout settings (e.g. if can not retrieve results from server to ADO.Net client for some default amount of time, there will be some timeout exception?)?
using (SqlConnection currentConnection = new SqlConnection("Data Source=.;Initial Catalog=TestDB;Trusted_Connection=true;Asynchronous Processing=true")) { // check current batch conut currentConnection.Open(); using (SqlCommand RetrieveOrderCommand = new SqlCommand()) { RetrieveOrderCommand.Connection = currentConnection; RetrieveOrderCommand.CommandType = CommandType.StoredProcedure; RetrieveOrderCommand.CommandText = "prc_GetOrders"; RetrieveBatchCountCommand.Parameters.Add("@Count", SqlDbType.Int).Direction = ParameterDirection.Output; RetrieveBatchCountCommand.ExecuteNonQuery(); int rowCount = Convert.ToInt32(RetrieveOrderCommand.Parameters["@Count"].Value); } }
thanks in advance, George