locked
Error - Operator + cannot be applied to operands of type object and object RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have below code

    foreach (DataRow item in dtExcelData.Rows)
                            {
                                if (item["Name"] == DBNull.Value || item["Name"].ToString() == "NULL")
                                {
                                    item["Name"] = "";
                                }
                                if (item["Department"] == DBNull.Value || item["Department"].ToString() == "NULL")
                                {
                                    item["Department"] = "";
                                }
                                if (item["Criteria"] == DBNull.Value || item["Criteria"].ToString() == "NULL")
                                {
                                    item["Criteria"] = "";
                                    item["Id"] = item["Name"] + item["Department"] + item["Criteria"];
                                }
                            }

    Thanks

    Tuesday, December 18, 2018 12:12 PM

Answers

  • User-821857111 posted
    item["Id"] = item["Name"].ToString() + item["Department"].ToString() + item["Criteria"].ToString();
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 18, 2018 1:47 PM