以下代码给出了错误:
尝试将元素作为与数组不兼容的类型进行访问。
using System.Collections.Generic;
using System.Data.SqlClient;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Sdk.Sfc;
using Microsoft.SqlServer.Management.Smo;
var database = server.Databases["mydemotest"];
var scripter = new Scripter(server);
scripter.Options.IncludeIfNotExists = true;
scripter.Options.ScriptSchema = true;
scripter.Options.ScriptData = true;
string scrs = "";
string tbScr = "";
foreach (Table myTable in database.Tables)
{
if (myTable.IsSystemObject == true) continue;
IEnumerable<string> tableScripts = scripter.EnumScript(new Urn[] { myTable.Urn });
foreach (string script in tableScripts)
scrs += script + "\n\n";
}
return (scrs + "\n\n" + tbScr);
此行IEnumerable<string> tableScripts = scripter.EnumScript(new Urn[] { myTable.Urn });
的例外情况
ArrayTypeMismatchException
的任何帮助?