Click here to Skip to main content
15,888,351 members
Home / Discussions / Database
   

Database

 
GeneralRe: Recursive CTE in T-SQL Pin
Rahul_Biswas25-Oct-16 0:58
professionalRahul_Biswas25-Oct-16 0:58 
GeneralRe: Recursive CTE in T-SQL Pin
Richard MacCutchan25-Oct-16 1:08
mveRichard MacCutchan25-Oct-16 1:08 
QuestionWhy SQL server maintenance plan Cannot rebuild clustered index offline? Pin
cornpoppy24-Oct-16 0:11
cornpoppy24-Oct-16 0:11 
AnswerRe: Why SQL server maintenance plan Cannot rebuild clustered index offline? Pin
Eddy Vluggen25-Oct-16 0:37
professionalEddy Vluggen25-Oct-16 0:37 
GeneralRe: Why SQL server maintenance plan Cannot rebuild clustered index offline? Pin
cornpoppy25-Oct-16 18:50
cornpoppy25-Oct-16 18:50 
GeneralRe: Why SQL server maintenance plan Cannot rebuild clustered index offline? Pin
Eddy Vluggen25-Oct-16 22:17
professionalEddy Vluggen25-Oct-16 22:17 
AnswerRe: Why SQL server maintenance plan Cannot rebuild clustered index offline? Pin
Richard Deeming26-Oct-16 3:23
mveRichard Deeming26-Oct-16 3: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 12:12
indian14321-Oct-16 12: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 2:38
cjb11018-Oct-16 2:38 
AnswerRe: Visual Studio Database Projects and General Use Pin
Matt U.18-Oct-16 10:12
Matt U.18-Oct-16 10:12 
GeneralRe: Visual Studio Database Projects and General Use Pin
cjb11019-Oct-16 20:56
cjb11019-Oct-16 20:56 
GeneralRe: Visual Studio Database Projects and General Use Pin
Matt U.20-Oct-16 5:01
Matt U.20-Oct-16 5:01 
SuggestionIncrease the Execution time or Connection Time out property of SSIS package from C# code Pin
indian14312-Oct-16 13:40
indian14312-Oct-16 13: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 6:39
indian14310-Oct-16 6: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 12:58
indian14312-Oct-16 12:58 
QuestionExport Access db to Sql Server db everyday Pin
meeram396-Oct-16 15:09
professionalmeeram396-Oct-16 15:09 
AnswerRe: Export Access db to Sql Server db everyday Pin
Eddy Vluggen10-Oct-16 6:58
professionalEddy Vluggen10-Oct-16 6:58 
QuestionIdentity_Column Pin
Member 111616253-Oct-16 19:43
Member 111616253-Oct-16 19:43 
AnswerRe: Identity_Column Pin
Chris Quinn3-Oct-16 23:11
Chris Quinn3-Oct-16 23:11 
AnswerRe: Identity_Column Pin
Swinkaran4-Oct-16 1:17
professionalSwinkaran4-Oct-16 1:17 
QuestionSQL Server Reporting Services Query to Get Stored Procedure Name for Shared Dataset Pin
David_4129-Sep-16 11:48
David_4129-Sep-16 11:48 
AnswerRe: SQL Server Reporting Services Query to Get Stored Procedure Name for Shared Dataset Pin
Mycroft Holmes29-Sep-16 12:43
professionalMycroft Holmes29-Sep-16 12:43 
GeneralRe: SQL Server Reporting Services Query to Get Stored Procedure Name for Shared Dataset Pin
David_4129-Sep-16 12:51
David_4129-Sep-16 12:51 
QuestionExecuting SSIS Package from C# Console App Pin
indian14328-Sep-16 4:51
indian14328-Sep-16 4:51 
AnswerRe: Executing SSIS Package from C# Console App - resolved Pin
indian14328-Sep-16 12:09
indian14328-Sep-16 12: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.