#region Namespaces
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.Data.OleDb;
using System.Windows.Forms;
#endregion
public void Main()
{
// TODO: Add your code here
//Declaring the variables
string oleDBConnString = string.Empty;
IDTSConnectionManagerDatabaseParameters100 connMrgParameters = default(IDTSConnectionManagerDatabaseParameters100);
System.Data.OleDb.OleDbConnection oledbConn = null;
ConnectionManager connMgr = Dts.Connections["LocalDB"];
//Reading the Connection manager Properties and assigning to variables
connMrgParameters = (IDTSConnectionManagerDatabaseParameters100)connMgr.InnerObject;
oledbConn = connMrgParameters.GetConnectionForSchema() as OleDbConnection;
oleDBConnString = oledbConn.ConnectionString;
MessageBox.Show(oleDBConnString, "Connection1");
//Declaring the variables
string oleDBConnString1 = string.Empty;
IDTSConnectionManagerDatabaseParameters100 connMrgParameters1 = default(IDTSConnectionManagerDatabaseParameters100);
System.Data.OleDb.OleDbConnection oledbConn1 = null;
ConnectionManager connMgr1 = Dts.Connections["DevServer1"];
//Reading the Connection manager Properties and assigning to variables
connMrgParameters1 = (IDTSConnectionManagerDatabaseParameters100)connMgr1.InnerObject;
oledbConn1= connMrgParameters1.GetConnectionForSchema() as OleDbConnection;
oleDBConnString1 = oledbConn1.ConnectionString;
MessageBox.Show(oleDBConnString1, "Connection2");
Dts.TaskResult = (int)ScriptResults.Success;
}
No comments:
Post a Comment