Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
namespace My_Project
{
    public abstract class global
    {





            public static SqlConnection conn()
            {

                SqlConnection cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename='D:\My_Project\My_Project\DATABASE\Soneri_Bank_loan_system.mdf';Integrated Security=True;Connect Timeout=0; Max Pool Size = 100; User Instance=True");

                try
                {
                    cn.Open();
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.Message);
                }
                return cn;
            }
        }
Posted
Comments
Nelek 24-Nov-12 5:18am    
And the question is...?
Please don't think we can read minds or do astral projections to see your monitor. If you need help, the least you could do is to to explain your problem in such a way, that the users of CP can understand it. Otherwise, nobody will be able to help you.
zeshanazam 24-Nov-12 5:33am    
connection string is above, got an error on form load "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached."

 
Share this answer
 
Comments
zeshanazam 25-Nov-12 3:23am    
Same problem exists.
Here is an article that is written for the same issue/error only:

ASP.NET - How To Use(Open/Close) Connections Correctly[^]

Go through this and you will get an idea of why this error must be coming.
 
Share this answer
 
Comments
zeshanazam 25-Nov-12 3:33am    
Same problem exists.

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