Object reference not set to an instance of an object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D Pahadsing

    Object reference not set to an instance of an object

    i'm using asp.net 1.1 & ms access.
    the ms-access database is placed in a separate folder with permissions set as belo
    Administrator : full contro
    ASPNET : full contro
    user1 : full contro
    & set to open in shared mode, no record locking
    the file is also shared for user1 to insert/update the database through a desktop Access Application

    I get the data & display it in the aspx page (no updating/inserting is done through the asp.net appln.) as below
    -get the records from Table1 & fill a DrpDown Box with th dat
    -based on the selection of the above dropdown box, I get a set of related records from Table2 & fill a datagrid with i
    the page works fine most of the times, but some times i get an error message "Object reference not set to an instance of an object." when the asp.net appln. tries to read data from the database & fill the dropdown box, though there is data in the table

    Is it due to exclusive locking by some form in the access appln or some problem with permissions or what else

    need urgent help pls

    thanx
  • Alvin Bruney [MVP]

    #2
    Re: Object reference not set to an instance of an object

    typically, this exception is thrown when a method or property is called on a
    null object. i suspect it is coming from the data returned in the dataset.
    are you explicitly testing before calling methods on the object? Consider:
    DataSet ds = "some query was fired to return results"
    test before you bind
    if(ds != null && ds.Tables[0].Rows.Count > 0)
    //bind
    else
    //indicate no data condition

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...

    "D Pahadsing" <dpahadsing@yah oo.co.in> wrote in message
    news:5F224CE0-C04D-4FB7-9BE5-74AFD2EEA622@mi crosoft.com...[color=blue]
    > i'm using asp.net 1.1 & ms access.
    > the ms-access database is placed in a separate folder with permissions set[/color]
    as below[color=blue]
    > Administrator : full control
    > ASPNET : full control
    > user1 : full control
    > & set to open in shared mode, no record locking.
    > the file is also shared for user1 to insert/update the database through a[/color]
    desktop Access Application.[color=blue]
    >
    > I get the data & display it in the aspx page (no updating/inserting is[/color]
    done through the asp.net appln.) as below:[color=blue]
    > -get the records from Table1 & fill a DrpDown Box with th data
    > -based on the selection of the above dropdown box, I get a set of related[/color]
    records from Table2 & fill a datagrid with it[color=blue]
    > the page works fine most of the times, but some times i get an error[/color]
    message "Object reference not set to an instance of an object." when the
    asp.net appln. tries to read data from the database & fill the dropdown box,
    though there is data in the table.[color=blue]
    >
    > Is it due to exclusive locking by some form in the access appln or some[/color]
    problem with permissions or what else?[color=blue]
    >
    > need urgent help pls.
    >
    > thanx[/color]


    Comment

    Working...