我正在尝试为我的数据库中的所有存储过程生成脚本,但它引发了以下异常:
要完成此操作,请设置属性AssemblyName。
这是我的代码
Server myServer = new Server("SHAIWAL-PC");
Scripter scripter = new Scripter(myServer);
Database myAdventureWorks = myServer.Databases["MyDataBase"];
Urn[] DatabaseURNs = new Urn[] { myAdventureWorks.Urn };
StringCollection scriptCollection = scripter.Script(DatabaseURNs);
string Script = string.Empty;
ScriptingOptions scriptOptions = new ScriptingOptions();
foreach (StoredProcedure mysp in myAdventureWorks.StoredProcedures)
{
StringCollection spscript = mysp.Script(scriptOptions);
spscript = mysp.Script();
foreach (string script in spscript)
{
Script += script;
Script += "<br/>";
}
}
请帮助某人