如题: using (IntegratedSuperviseEntities entitys = new IntegratedSuperviseEntities(this.connectionString))
            {
                var cus = from template in entitys.Tbl_AttachmentTemplate
                          orderby template.CreateTime descending
                          select template;
                return cus.ToArray();
            }

解决方案 »

  1.   

    using(数据库连接connection)
    {
    using(数据库操作command)
    {}
    }
    系统会自动释放资源。不用考虑数据操作中忘记关闭链接的问题等等。
      

  2.   

    linq 吧。   var cus = from template in entitys.Tbl_AttachmentTemplate
    除linq外真不知道还有什么东东是这样写的。
      

  3.   

    LINQ  啊~~~你是不是想说他的查询语句写错了啊???
        呵呵..  LINQ 的语法就这德性...................
      

  4.   

    呵呵.. LINQ 的语法就这德性