0

The system some time give the error mentioned in the title. the code block is given below. when i debug or try to check it it does not give an error but when the system is running it gives error. i use this code in remoting application which runs 24 hour. some one to answer please.

try
        {
            foreach (DataRow row in table.Rows)
            {
               Item item = new Item();
                if (row["ID"] != null)
                {
                    item.ID = long.Parse(row["SetID"].ToString());
                    IProtocols p = Cache.ALL.Find(item.ID,UniqueID);
                    foreach (Item protocol in p)
                    {
                        item.ID = protocol.AgencyID;
                        item.Actions = protocol.Actions;
                        item.CreatedByID = protocol.CreatedByID;
                        item.CreatedDate = protocol.CreatedDate;
                        item.Deleted = protocol.Deleted;
                        item.OId = protocol.OId;
                        item.Name = protocol.Name;
                        item.ID = protocol.ID;
                    }
                }

                item.ID = long.Parse(row["SetID"].ToString());
                if (row["ID"] != DBNull.Value)
                {
                    item.OID = long.Parse(row["OID"].ToString());
                }

                if (row["CreatedByID"] != DBNull.Value)
                {
                    item.AssignedByID = long.Parse(row["CreatedByID"].ToString());
                }


                    Cache.ALL.Add(item);

            }
        }
        catch (Exception ex)
        {
            throw new Exception("Error: " + ex.Message);
        }
Sahib Khan
  • 557
  • 4
  • 19
  • The point is i am not going to change the row object referred in the loop as shown in the code. then why the error? – Sahib Khan Nov 08 '14 at 12:22
  • I have marked that i am not changing the collection reffered in the loop but still the problem is there. please see. thanks – Sahib Khan Nov 08 '14 at 12:26

0 Answers0