我尝试创建一个这样的:
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.
创建目录后是否需要添加其他步骤才能正确使用它?