Click here to Skip to main content
15,743,179 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am getting connection timeout error in sql when selecting datas from table takes more time..nearlly (3 min)

i used:
con.ConnectionString = "Data Source=datasource;uid=uid;pwd=pwd;Initial Catalog=database;Integrated Security=false;Connection Timeout=30000";
but still i am getting the error, can you please help me

Are you actually connecting ? (Valid UserID/Password SQL User ?)

You have Integrated Security set to false here, deliberately ?

Express version of SQL Server or not ?

SQL Server set to use both authentication methods ? Or if just one which ?

Share this answer
Are you getting the timeout while you connect to the datavase, or when you try to select the data?
Share this answer
Then you have to increase your command timeout. This cannot be done with the connection string as far as I know.
Share this answer
I Have removed the" Integrated Security=false;" but still i am getting the error "System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.".
Share this answer
Connection established successfully, This error occurs when the query execute.
Share this answer
Wow thank a lot...i got it bu setting command.COnnectionTimeOut = 100
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900