是否可以在内存中创建ADOX目录并填充它?

时间:2015-09-28 19:38:31

标签: asp.net ms-access memory datatable ado.net

我尝试创建一个这样的:

        using (MemoryStream stream = new MemoryStream())
        {
            Catalog catalog = new Catalog(stream);   // do I need to add more after this?

            foreach (DataTable dt in ds.Tables)
            {
                Table adoxTable = new Table();
                adoxTable.Name = dt.TableName;
                adoxTable.ParentCatalog = catalog;   // issue is here

                catalog.Tables.Append(table);
            }

            return stream.ToArray();
        }

然而,当我到达adoxTable.ParentCatalog = catalog;行时,我得到了例外:The connection cannot be used to perform this operation. It is either closed or invalid in this context.

创建目录后是否需要添加其他步骤才能正确使用它?

0 个答案:

没有答案