Add data row error (object reference not set to an instance of an object)

i have used for each row, within loop i have used add row item but im getting error (object reference not set to an instance of an object) since in some column ,values are empty

hi @Ananya1,

Before adding you can verify the Object you are adding is Not null , If not Null then Add , otherwise Skip.


but Foreach is QueueItem

What is the Source and destination here … Destination is QueueItem I guess … If possible can you share the Code Screenshot where you are getting this exception.


im taking queue items by using getqueue and using for each row(queueitems ) and then add data row in which i am getting error since some values are null

you need to fix it or give some default values or apply condition


im getting error(Object reference not set to an instance of an object.)

Here we can have Null Reference Because of 2 Issues :

  1. SpeceficeContent(“Abcde”) is null - That is handeled , I can see in screenshot - Add or String.IsNullorWhiteSpace also.

  2. The DataTable you are Adding the Data Row is Null . Can you Verify the same once ?

You can verify it by using DataTableName is Nothing.


im getting error within if condition ,

Before this If - Check if the key available

item.ContainsKey(“abcde”) - If available then Proceed for checking

Have a look at below Link.


1 Like

no, item. containskey isnot visible


.containskey is also not visible

Hey! Have u got the solution for this?
Best Regards