MysqlConnection 关闭了 但是Mysql里状态是sleep

DataSet ds = db.FindDataAdapter("select * from news order by rand() LIMIT 6;");

public DataSet FindDataAdapter(string sql,params string[] str)
{
MySqlConnection conn = DB.Getconn();
conn.Open();
MySqlDataAdapter msd = new MySqlDataAdapter(sql,conn);
DataSet ds = new DataSet();
msd.Fill(ds);
msd.Dispose();
CloseConnection(conn);
return ds;
}

                   private static void CloseConnection(MySqlConnection conn)
    {
        if (conn.State == ConnectionState.Open)
        {
            conn.Close();
            conn.Dispose();
        }
    }

执行完后Mysql 查看链接还有sleep 挂起的链接 如何释放?

查看全部
adobase
adobase
2015/06/30 08:22
  • c#
  • 点赞
  • 收藏
  • 回答
    私信

4个回复