本文整理汇总了C#中Application.LoadFromSqlServer方法的典型用法代码示例。如果您正苦于以下问题:C# Application.LoadFromSqlServer方法的具体用法?C# Application.LoadFromSqlServer怎么用?C# Application.LoadFromSqlServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application.LoadFromSqlServer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
protected override Package Load(IEtl etl, Application app)
{
var server = etl.Server.Replace(" ", "");
if(server.ToLower()=="(local)")
server=".";
var packageName = etl.Path + etl.Name;
if (!packageName.ToLower().EndsWith(".dtsx"))
packageName += ".dtsx";
var events = new PackageEvents();
var package = app.LoadFromSqlServer(packageName, server, etl.UserName, etl.Password, events);
return package;
}
示例2: btnBulkCopy_Click
protected void btnBulkCopy_Click(object sender, EventArgs e)
{
try
{
Package pkg;
Application app;
DTSExecResult pkgResults;
MyEventListener eventListener = new MyEventListener();
//pkgLocation = "D:\\dts\\TestDataPKG.dtsx";
app = new Application();
//Load Package from File system.
//pkg = app.LoadPackage(pkgLocation, eventListener);
//app.SaveToXml("D:\\test.xml", pkg, eventListener);
//pkgResults = pkg.Validate(null, null, null, null);
//pkgResults = pkg.Execute(null, null, eventListener, null, null);
string pkgName = String.Empty;
string sqlServer = String.Empty;
string userID = String.Empty;
string pwd = String.Empty;
pkgName = ConfigurationManager.AppSettings["PackageName"]; // Give the Name of the DTS Package in SQL Server.
sqlServer = ConfigurationManager.AppSettings["ServerName"]; // Name of the SQL Server.
userID = ConfigurationManager.AppSettings["UserName"]; // Sql Server User ID.
pwd = ConfigurationManager.AppSettings["Password"]; // Sql Server Password.
//Load Package from sql server.
pkg = app.LoadFromSqlServer(pkgName, sqlServer, userID, pwd, eventListener);
pkgResults = pkg.Execute(null, null, eventListener, null, null);
lblResult.Text = "DTS Package Executed Successfully...";
btnBulkCopy.Visible = false;
btnImportData.Visible = true;
}
catch (Exception ex)
{
lblResult.Text = "Exception: " + ex.Message;
}
}
示例3: LoadSqlPackages
private static IEnumerable<PackageDescriptor> LoadSqlPackages(IContext context, ProgressRecord progressRecord, Application application, string serverName, string path)
{
progressRecord.CurrentOperation = "Processing SQL path " + path + "...";
context.WriteProgress(progressRecord);
var packageInfos = application.GetPackageInfos(path, serverName, null, null);
var packageItems = packageInfos.Cast<PackageInfo>();
var folders = from p in packageItems
where p.Flags == DTSPackageInfoFlags.Folder
select p;
packageItems = from p in packageItems
where p.Flags == DTSPackageInfoFlags.Package
select p;
var packages = packageItems.ToList()
.ConvertAll(
p =>application.LoadFromSqlServer(p.Folder + "\\" + p.Name, serverName, null, null, null)
)
.ConvertAll(p => new PackageDescriptor(p, path))
.ToList();
if (folders.Any())
{
var children = folders.ToList()
.ConvertAll(f => LoadSqlPackages(context, progressRecord, application, serverName, f.Folder + "\\" + f.Name));
children.ForEach(packages.AddRange);
}
return packages;
}