0
我想在C#中用編程方式改變存儲過程與SMO。除了改變步驟之外,一切似乎都起作用。連接和存儲過程連接都很好。請幫助,爲什麼它不改變我的數據庫?SMO C#改變失敗現有的存儲過程參數
using System;
using System.Data;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
namespace DBChecker
{
public class A
{
public static void Main(string[] args)
{
String sqlServerLogin = "*****";
String password = "****";
String instanceName = "";
String remoteSvrName = "****";
ServerConnection srvConn2 = new ServerConnection(remoteSvrName);
srvConn2.LoginSecure = true;
Server srv3 = new Server(srvConn2);
Console.WriteLine(srv3.Information.Version);
Console.WriteLine("Connection Established");
Database db;
db = srv3.Databases["decision"];
Console.WriteLine("DB Connection Established");
StoredProcedure sp;
sp = new StoredProcedure(db,"copy_alias_by_type");
Console.WriteLine("SP Connection Established");
sp.TextMode = false;
sp.AnsiNullsStatus = false;
sp.QuotedIdentifierStatus = false;
StoredProcedureParameter param;
param = new StoredProcedureParameter(sp, "@alstyp");
param.DataType = DataType.Char(100);
sp.Refresh();
sp.Alter();
Console.WriteLine("DataType Changed");
Console.ReadKey();
}
}
}