Skip to content

some computer ado.net handcount increasing #235

@staunchheart

Description

@staunchheart
 .net framework 4.8 
 win10
 Not all computers behave this way; it's just some computers.
The system has updated all patches

var conStr=.......;

var scb = new SqlConnectionStringBuilder(conStr);
scb.ApplicationName = "DscServerD";
scb.Pooling = false;
// scb.MinPoolSize = 5;
// scb.MaxPoolSize = 100;
// scb.LoadBalanceTimeout = 5;
conStr = scb.ConnectionString;
Console.WriteLine(conStr);
Console.WriteLine("start debug\r\n");
string sql = "SELECT sort_no AS id,sort_name AS name,leag_flag AS remark FROM leag_sort where ltrim(sort_no)<>'' order by sort_no ";
while (true)
{
Thread.Sleep(5000); //主进程1秒1次

    try
    {
        using(SqlConnection conn=new SqlConnection(conStr))
         {
             using(SqlDataAdapter sda=new SqlDataAdapter(sql, conn))
             {
                 using (DataTable dt = new DataTable())
                 {
                     sda.Fill(dt);
                    //HandleCount will increasing 3
                     Console.WriteLine(string.Format("hand:{0}; query count {1}", Process.GetCurrentProcess().HandleCount, dt.Rows.Count));
                 }
             
             }
           
         }
      
    }
    catch (Exception ex)
    {
        Console.WriteLine(string.Format("hand:{0};  debug:{1}", Process.GetCurrentProcess().HandleCount, ex.Message));

    }

}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions