SQL Server - Time out Expired Problem(Help me)

Asked By ALOK RANJAN on 21-Jun-12 04:59 AM
hi everyone ,

                       I have  a table in sqlserver database which contains 15,00000( 1.5 crore record )
                      and field are Registration No,CSC Code,Physical Code now I want to search record according to Registration number but when we enter Reg No. It take too much time to find that particular record .and throw a error 

(Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.)
Please provide me best solution for fast searching and also give me solution of (Timeout expired. )

Thanks & Best Record


Jitendra Faye replied to ALOK RANJAN on 21-Jun-12 05:00 AM
For this increase Timeout in web.config file-

<httpRuntime executionTimeout="value"/>
S K replied to ALOK RANJAN on 21-Jun-12 05:09 AM
If you don't want to timeout than just set Timeout = -1 in you command object than never time-out expire.
TSN ... replied to ALOK RANJAN on 21-Jun-12 05:12 AM

hi.. try the below

set the command TimeOut parameter to 0 , so that query executes till the end.

sqlComm.CommandTimeout = 0;

add the property in the connection string ConnectTimeout=120 in web.config

DL M replied to ALOK RANJAN on 21-Jun-12 05:33 AM

follow this steps.
Run –> Administrative tools –> Firewall –> Inbound rule–> Right click –> New rule –> Select port –> Click next –> Enter the SQL server port number –> Select the default –> Next –> Select the profile whatever you want –> Enter the name
dipa ahuja replied to ALOK RANJAN on 21-Jun-12 07:33 AM
Increase the timeOut attribute of your connection
 <add name="ConnectionString" connectionString="Data Source=;Initial Catalog=;Persist Security Info=True;User ID=sa;Password=sa@123;Connect Timeout=200" providerName="System.Data.SqlClient"/>
 SqlConnection conn = new SqlConnection("ConnString");
 SqlCommand comm = new SqlCommand();
 comm.CommandTimeout = 120;