locked
DataSet Access is throwing NullReferenceException RRS feed

  • Question

  • This portion of my code is creating a nullReferenceException when I am trying to access a certain row of an Access file.

    
    
    Thursday, May 1, 2014 2:54 AM

Answers

  • This means that the FindByPID method doesn't return anything, i.e. the oldRow variable is a NULL reference.

    You should make sure that the FindByPID method does what you expect it to do and that you have a corresponding row with the PID = "123456" in the database.

    • Proposed as answer by Youen Zen Thursday, May 1, 2014 2:48 PM
    • Marked as answer by Fred Bao Thursday, May 8, 2014 6:40 AM
    Thursday, May 1, 2014 2:36 PM

All replies

  • This portion of my code is creating a nullReferenceException when I am trying to access a certain row of an Access file.

    Specifically when I try to throw the oldRow.PID on the Textbox.
    
    PID = "123456";
    oldRow = finalCoachDBDataSet1.Coach.FindByPID(PID);
    Textbox_PID.Text = oldRow.PID;
    Textbox_Name.Text = oldRow.Name;
    Textbox_Phone.Text = oldRow.Phone;
    Textbox_Description.Text = oldRow.Description;
                



    Thursday, May 1, 2014 2:56 AM
  • This means that the FindByPID method doesn't return anything, i.e. the oldRow variable is a NULL reference.

    You should make sure that the FindByPID method does what you expect it to do and that you have a corresponding row with the PID = "123456" in the database.

    • Proposed as answer by Youen Zen Thursday, May 1, 2014 2:48 PM
    • Marked as answer by Fred Bao Thursday, May 8, 2014 6:40 AM
    Thursday, May 1, 2014 2:36 PM