DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005

    asp.net 2.0 weird datatable problem

    Hi folks!
    I am experiencing to me a weird problem with my datatables. I have a dataset which contains multiple datatables, generated from stored procedures and tables by the drag and drop interface in VS 2005. However when I am populating these tables i get an error message saying

    A first chance exception of type 'System.NullReferenceException' occurred in Server.DLL

    Server.DLL is my business layer. It appears that this appears on a non-regular basis but by stepping through my code I have located the error to be in the following snippet

    IssuesDataset.IssueReportsReadableDataDataTable returnTable;
    DataTable tempTable;

    returnTable = new IssuesDataset.IssueReportsReadableDataDataTable();

    tempTable = sqlServerImpersonation.ExecuteDataset([REMOVED BY AUTHOR, GETS A DATASET]).Tables[0];

    //Here is the error thrown, sometimes the debugger points out that DataRow //dataRow is the reason, other times the keyword in and other times again //the bracket below the foreach statement
    foreach (DataRow dataRow in tempTable.Rows)

    return returnTable;

    The datatable is populated and it works, but this error is driving me insane...

    Hopefully someone has an idea about what's causing this.

  2. #2
    Join Date
    Nov 2003
    Portland, OR
    I would add code to ensure that tempTable and tempTable.Rows are not null:
    tempTable = sqlServerImpersonation.ExecuteDataset(...).Tables[0];
    if (tempTable != null)
        if (tempTable.Rows != null)
            foreach (DataRow dataRow in tempTable.Rows)
    Phil Weber

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Replies: 0
    Last Post: 10-06-2005, 11:20 AM
  2. Still a problem sending email from ASP.Net
    By George Ceaser in forum ASP.NET
    Replies: 0
    Last Post: 10-25-2002, 10:03 AM
  3. Free ASP.NET Web Matrix Design/Editor Tool Released
    By ASPSmith Training in forum dotnet.announcements
    Replies: 0
    Last Post: 06-18-2002, 03:39 AM
  4. problem with running asp.net application
    By evgeny in forum ASP.NET
    Replies: 0
    Last Post: 05-08-2002, 04:28 AM
  5. dropdownlist problem in asp.net
    By vijay in forum ASP.NET
    Replies: 1
    Last Post: 05-06-2002, 11:58 AM

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

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

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.