Object null reference in user control


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Object null reference in user control

  1. #1
    Jason Salas Guest

    Object null reference in user control

    Does anyone know why my code would suddenly be throwing the "Object
    reference not set to an instance of an object." error?

    Here it is, within a user control that's used by another page:


    Exception Details: System.NullReferenceException: Object reference not set
    to an instance of an object.
    Source Error:
    Line 11: kuamcom.Data.DataAccessTier data = new
    kuamcom.Data.DataAccessTier();
    Line 12: DataSet ds = data.GetHomepageNewsHeadlines();
    Line 13: rptNews.DataSource = ds.Tables[1].DefaultView; // the
    faulty line
    Line 14: rptNews.DataBind();


    This works perfectly with an ASP.NET 1.0 server at home, but when I deployed
    it to a production server, it started throwing this error. Any ideas? I
    did some testing and it seems to be the DataSet object referenced with
    "ds.Tables[1].DefaultView;"

    Thanks!



  2. #2
    Jason Salas Guest

    Re: Object null reference in user control

    Never mind...I figured it out. It was a write permission error.

    jas


    "Jason Salas" <jason@kuam.com> wrote in message
    news:3f3f2630@tnews.web.devx.com...
    > Does anyone know why my code would suddenly be throwing the "Object
    > reference not set to an instance of an object." error?
    >
    > Here it is, within a user control that's used by another page:
    >
    >
    > Exception Details: System.NullReferenceException: Object reference not set
    > to an instance of an object.
    > Source Error:
    > Line 11: kuamcom.Data.DataAccessTier data = new
    > kuamcom.Data.DataAccessTier();
    > Line 12: DataSet ds = data.GetHomepageNewsHeadlines();
    > Line 13: rptNews.DataSource = ds.Tables[1].DefaultView; // the
    > faulty line
    > Line 14: rptNews.DataBind();
    >
    >
    > This works perfectly with an ASP.NET 1.0 server at home, but when I

    deployed
    > it to a production server, it started throwing this error. Any ideas? I
    > did some testing and it seems to be the DataSet object referenced with
    > "ds.Tables[1].DefaultView;"
    >
    > Thanks!
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center