Click here to Skip to main content
15,895,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I had a table "TRnasaction";
having fields, SlNo, Date,Currency, BuyRate,SellRate,CustomerID

( and this table have more than 1 million records( 1,766,568,987) records,
During Feching it showing the ConnectionTimeOutException, these records

What I have tried:

Select SlNo, Date, CurrencyID, BuyRate,SellRate,CustomerID from TRANSACTION T
inner join CURRENCY C on T.CurrencyID=C.CurrencyID
inner join CUSTOMER CS on T.CustomerID=CS.CustomerID
Posted
Updated 21-Aug-16 19:08pm
v2

0) Increase the SQlCommand.CommandTimeout : SqlCommand.CommandTimeout Property (System.Data.SqlClient)[^]
1) Query less data (you don't need to show 1 billion records)
2) Optimize your indexes based on your query pattern, use the SQL Profiler : How To: Use SQL Profiler[^]
3) If possible partition your data to lower the table size : Create Partitioned Tables and Indexes[^]
 
Share this answer
 
Comments
Maciej Los 21-Aug-16 13:59pm    
Short And To The Point!
5!
Mehdi Gholam 21-Aug-16 14:01pm    
Thanks Maciej!
You can append ;Connection Timeout=30 to your connection string and specify the value you wish.
SqlConnection.ConnectionTimeout Property (System.Data.SqlClient)
A value of 0 indicates no limit, and should be avoided in a ConnectionString because an attempt to connect waits indefinitely.
 
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