如何使用SMO显示ndf文件?
我正在使用 SMO 填充数据库文件日志文件列表。我正在使用文件组,但它仅显示 mdf 和 ldf 文件。我有 ndf 文件,它也不显示 ndf 文件吗?我有什么建议吗???
string dbname = string.Empty, DatabaseInfo = string.Empty;
Server srv = new Server(instanceName);
foreach (Database db in srv.Databases)
{
if (DB.Equals(db.Name))
{
DatabaseInfo += db.FileGroups[0].Files[0].FileName;
string logfile=db.LogFiles[0].FileName ;
}
}
I am using SMO to populate the list of database files log files. i am using filegroups but it displays only mdf and ldf files. I have ndf files also it is not dispalying ndf files?? what i have to do any suggestions plz???
string dbname = string.Empty, DatabaseInfo = string.Empty;
Server srv = new Server(instanceName);
foreach (Database db in srv.Databases)
{
if (DB.Equals(db.Name))
{
DatabaseInfo += db.FileGroups[0].Files[0].FileName;
string logfile=db.LogFiles[0].FileName ;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,如果这说明了一些显而易见的事情,但您正在专门访问第一个文件组和该组的第一个文件。如果您不枚举文件组和文件集合,为什么您会期望看到辅助文件?
编辑:添加了代码摘录。
Sorry if this is stating something a bit obvious, but you are specifically accessing the first filegroup and first file of that group. If you do not enumerate the filegroups and files collection, why would you expect to see the secondary files?
Edit : Added a code extract.