locked
Object Reference is not setto an instence of object error is coming from following code RRS feed

  • Question

  • HD_ROOMFACIGROUPTableAdapter adapter = new HD_ROOMFACIGROUPTableAdapter();
    HDeskDataset.HD_ROOMFACIGROUPDataTable tb = new HDeskDataset.HD_ROOMFACIGROUPDataTable();
     adapter.Fill(tb);
    HDeskDataset.HD_ROOMFACIGROUPRow r = tb.FindByHD_ROOMFACIGROUP_FACILITYGROUPCODE(code);

    string goupname2=r.HD_ROOMFACIGROUP_GROUPNAME;   // here is the Error is Coming

    Saturday, April 11, 2015 1:52 PM

Answers

  • The error is telling you that r is null. That is presumably because

    tb.FindByHD_ROOMFACIGROUP_FACILITYGROUPCODE(code)

    didn't return anything. You should check that a value is returned before trying to use it.

    • Marked as answer by RAGU DEVA Wednesday, April 15, 2015 1:00 PM
    Saturday, April 11, 2015 2:28 PM