ADO.NET - 连接池

SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();

 

builder.DataSource = "127.0.0.1";

builder.InitialCatalog = "database";

builder.UserID = "user";

builder.Password = "user";

builder.Pooling = true;

builder.MaxPoolSize = 3;

builder.MinPoolSize = 2;

 

SqlConnection con = new SqlConnection(builder.ConnectionString);

SqlCommand com = con.CreateCommand();

con.Open();

com.CommandText = "select";

com.ExecuteNonQuery();

con.Close();

 

 

SqlConnection.ClearAllPools();

posted @ 2008-08-11 13:20  许晓光  阅读(191)  评论(0编辑  收藏  举报