c# SSIS - Object reference not set to an instance of an object -
i working on ssis package (this new me). using script component source, using readonlyvariable (varpackagepath) , assigned value 'c:\development\ssisprojects\vs2012\geterrorcolumn\geterrorcolumn\package.dtsx' location of project. script used relavent column error occured. link following : http://www.techbrothersit.com/2013/12/ssis-how-to-get-error-column-name-in.html
i have debugged c# code , getting error @ line :
taskname = executablenode.selectsinglenode("dts:property[@dts:name='objectname']", namespcmgr).innertext;
error : 'object reference not set instance of object'
.
my c# code :
public override void createnewoutputrows() { /* add rows calling addrow method on member variable named "<output name>buffer". example, call myoutputbuffer.addrow() if output named "myoutput". */ //declare variables string taskname; string colname; int32 collineageid; string colkey; //read package file xmldocument packagefile = new xmldocument(); packagefile.load(variables.varpackagepath); //create hash table hashtable colkeytable = new hashtable(); xmlnamespacemanager namespcmgr = new xmlnamespacemanager(packagefile.nametable); namespcmgr.addnamespace("dts", "www.microsoft.com/sqlserver/dts"); foreach (xmlnode childnode in packagefile.selectnodes("//*[@lineageid != '' , @name != '']")) { xmlnode executablenode = childnode.selectsinglenode("ancestor::dts:executable[1]", namespcmgr); taskname = executablenode.selectsinglenode("dts:property[@dts:name='objectname']", namespcmgr).innertext; colname = childnode.attributes["name"].value; collineageid = convert.toint32(childnode.attributes["lineageid"].value); colkey = taskname + colname + collineageid; if (!colkeytable.containskey(colkey)) { colkeytable.add(colkey, dbnull.value); output0buffer.addrow(); output0buffer.collineageid = collineageid; output0buffer.colname = colname; output0buffer.taskname = taskname; } } }
any help/suggestion please.
Comments
Post a Comment