Click here to Skip to main content
14,768,021 members
Home » Discussions » Database
   

Database

 
GeneralRe: Recursive CTE in T-SQL Pin
Rahul_Biswas25-Oct-16 1:58
professionalRahul_Biswas25-Oct-16 1:58 
GeneralRe: Recursive CTE in T-SQL Pin
Richard MacCutchan25-Oct-16 2:08
mveRichard MacCutchan25-Oct-16 2:08 
QuestionWhy SQL server maintenance plan Cannot rebuild clustered index offline? Pin
cornpoppy24-Oct-16 1:11
Membercornpoppy24-Oct-16 1:11 
AnswerRe: Why SQL server maintenance plan Cannot rebuild clustered index offline? Pin
Eddy Vluggen25-Oct-16 1:37
professionalEddy Vluggen25-Oct-16 1:37 
GeneralRe: Why SQL server maintenance plan Cannot rebuild clustered index offline? Pin
cornpoppy25-Oct-16 19:50
Membercornpoppy25-Oct-16 19:50 
GeneralRe: Why SQL server maintenance plan Cannot rebuild clustered index offline? Pin
Eddy Vluggen25-Oct-16 23:17
professionalEddy Vluggen25-Oct-16 23:17 
AnswerRe: Why SQL server maintenance plan Cannot rebuild clustered index offline? Pin
Richard Deeming26-Oct-16 4:23
mveRichard Deeming26-Oct-16 4:23 
QuestionConfiguration from a parent variable "ServerName" did not occur because there was no parent variable collection or Edit the existing Package Configurations using C# Pin
indian14321-Oct-16 13:12
Memberindian14321-Oct-16 13:12 
Hi,

I am executing an SSIS package using my C# code, its saying package executing successfully but unfortunately when I checking in the database, it is not putting the values into that Server, in between the execution
I am getting a Warning that "Configuration from a parent variable "ServerName" did not occur because there was no parent variable collection.", if really package is having issues in connections and variables, how can I set the variable values differently than below, below is the code how I am setting the Package connections and Variables.

It seems that package is using some configurations, is there any way I can modify the existing package configurations at run time using C# code? I don't want to add new configurations to package but want to edit the existing ones to match my needs.

Here is the code, any help would be very very helpful for me thanks in advance my friends.
public void SetRetainSameConnection()
{
    try
    {
        if (_Status == DTSPackageStatus.Loaded)
        {
            Connections connections = _Pkg.Connections;

            if (connections != null)
            {
                for (int Idex = 0; Idex < connections.Count; Idex++)
                {
                    ConnectionManager connection = connections[Idex];

                    if (connection.Properties.Contains("RetainSameConnection"))
                        connection.Properties["RetainSameConnection"].SetValue(connection, true);
                }
            }
        }
    }
    catch (Exception ex)
    {
        _Status = DTSPackageStatus.LoadFailed;
        throw ex;
    }
}
public void SetPakageConnections(System.Collections.Hashtable ConnectionCollection)
{
    try
    {
        if (_Status == DTSPackageStatus.Loaded)
        {
            Connections connections = _Pkg.Connections;

            if ((ConnectionCollection != null) && (connections != null))
            {
                for (int Idex = 0; Idex < connections.Count; Idex++)
                {
                    ConnectionManager connection = connections[Idex];

                    //connection.Properties["RetainSameConnection"].SetValue(connection, true);

                    string ConName = connection.Name;

                    if (ConnectionCollection.Contains(ConName))
                    {
                        connection.ConnectionString =
                            ConnectionCollection[ConName].ToString();
                    }
                }
            }
        }
    }
    catch (Exception ex)
    {
        _Status = DTSPackageStatus.LoadFailed;

        throw ex;
    }
}

public void SetPakageVariables(System.Collections.Hashtable VariableCollection)
{
    try
    {
        if (_Status == DTSPackageStatus.Loaded)
        {
            Variables variables = _Pkg.Variables;
            if ((VariableCollection != null) && (variables != null))
            {
                for (int Idex = 0; Idex < variables.Count; Idex++)
                {
                    Variable variable = variables[Idex];
                    string VarName = variable.Name;

                    if (VariableCollection.Contains(VarName))
                    {
                        bool IsReadOnly = (bool)variable.Properties["ReadOnly"].GetValue(variable);
                        if (!IsReadOnly)
                            variable.Value =
                                VariableCollection[VarName].ToString();
                    }
                }
            }
        }
    }
    catch (Exception ex)
    {
        _Status = DTSPackageStatus.LoadFailed;
        throw ex;
    }
}
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."


modified 21-Oct-16 20:20pm.

QuestionVisual Studio Database Projects and General Use Pin
cjb11018-Oct-16 3:38
Membercjb11018-Oct-16 3:38 
AnswerRe: Visual Studio Database Projects and General Use Pin
Matt U.18-Oct-16 11:12
MemberMatt U.18-Oct-16 11:12 
GeneralRe: Visual Studio Database Projects and General Use Pin
cjb11019-Oct-16 21:56
Membercjb11019-Oct-16 21:56 
GeneralRe: Visual Studio Database Projects and General Use Pin
Matt U.20-Oct-16 6:01
MemberMatt U.20-Oct-16 6:01 
SuggestionIncrease the Execution time or Connection Time out property of SSIS package from C# code Pin
indian14312-Oct-16 14:40
Memberindian14312-Oct-16 14:40 
QuestionTo run a SSIS package outside of SQL server data tools you must install populate filecollection of integration services or higher Pin
indian14310-Oct-16 7:39
Memberindian14310-Oct-16 7:39 
AnswerRe: To run a SSIS package outside of SQL server data tools you must install populate filecollection of integration services or higher - resolved Pin
indian14312-Oct-16 13:58
Memberindian14312-Oct-16 13:58 
QuestionExport Access db to Sql Server db everyday Pin
meeram396-Oct-16 16:09
professionalmeeram396-Oct-16 16:09 
AnswerRe: Export Access db to Sql Server db everyday Pin
Eddy Vluggen10-Oct-16 7:58
professionalEddy Vluggen10-Oct-16 7:58 
QuestionIdentity_Column Pin
Member 111616253-Oct-16 20:43
MemberMember 111616253-Oct-16 20:43 
AnswerRe: Identity_Column Pin
Chris Quinn4-Oct-16 0:11
MemberChris Quinn4-Oct-16 0:11 
AnswerRe: Identity_Column Pin
Swinkaran4-Oct-16 2:17
professionalSwinkaran4-Oct-16 2:17 
QuestionSQL Server Reporting Services Query to Get Stored Procedure Name for Shared Dataset Pin
David_4129-Sep-16 12:48
MemberDavid_4129-Sep-16 12:48 
AnswerRe: SQL Server Reporting Services Query to Get Stored Procedure Name for Shared Dataset Pin
Mycroft Holmes29-Sep-16 13:43
professionalMycroft Holmes29-Sep-16 13:43 
GeneralRe: SQL Server Reporting Services Query to Get Stored Procedure Name for Shared Dataset Pin
David_4129-Sep-16 13:51
MemberDavid_4129-Sep-16 13:51 
QuestionExecuting SSIS Package from C# Console App Pin
indian14328-Sep-16 5:51
Memberindian14328-Sep-16 5:51 
AnswerRe: Executing SSIS Package from C# Console App - resolved Pin
indian14328-Sep-16 13:09
Memberindian14328-Sep-16 13:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.