get count of Rows Affected by Package Execution - SMO

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sachinkale123
    New Member
    • Jul 2007
    • 37

    get count of Rows Affected by Package Execution - SMO

    I am running my package using 'LoadFromSqlSer ver()' in SMO. I am successfully able to run it but I want number of rows which were affected using that package in a Database. So Is there any way for this.

    my code is as follows.

    Code:
    Package pkgIn;
    
    Application app;
    DTSExecResult pkgResults;
    
    
    pkgIn = app.LoadFromSqlServer(PackPath ,ServerName , UserName , Passward , null);
    pkgResults = pkgIn.Execute();
    Please help me on this as I have wasted too much of time on this and I got no help for this..
    Thanx in adavance..
  • nukefusion
    Recognized Expert New Member
    • Mar 2008
    • 221

    #2
    I don't think that it will give you that out-of-the-box. Based on my very limited working knowledge it should be possible to create a variable within your package and record the affected rows in there. Assuming you called the variable "rowcount" you could then retrieve it from your app my adjusting your code to this:

    Code:
    Package pkgIn; 
      
    Application app; 
    DTSExecResult pkgResults; 
      
      
    pkgIn = app.LoadFromSqlServer(PackPath ,ServerName , UserName , Passward , null); 
    pkgResults = pkgIn.Execute();
    
    int rowCount = Convert.ToInt32(pgnIn.Variables["rowCount"].Value);

    Comment

    Working...