Results 1 to 2 of 2

Thread: DataRelation query ?

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    The mystic land of Geordies

    DataRelation query ?

    Can someone tell me what is wrong with this line of code :
      DataRelation relationActState = new DataRelation("ActState", dsActivities.Tables["dtActivity"].Columns["ActivityInstanceId"], dsActivities.Tables["dtState"].Columns["ActivityInstanceId"], false);
    I keep getting

    {"Object reference not set to an instance of an object."}

    This seems pretty straight forward to me. :-(


  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Sydney, Australia

    Re: DataRelation query ?

    There's nothing wrong with the syntax if you're getting that exception. The problem is that you're trying to access an instance member through a variable that doesn't refer to an instance. I would guess that your DataSet doesn't contain either or both of those tables, although it may be that one or both of the columns are the issue. It's not hard to find out what the issue is though. When the exception is thrown just use the debugger to test each reference on that line until you find the one that is null.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width