Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5990379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:14:09+00:00 2026-05-22T23:14:09+00:00

I have a DataSet where I need to find out how many rows has

  • 0

I have a DataSet where I need to find out how many rows has been changed using the following code:

dataTable1 = dataSet1.Tables["FooTable"].GetChanges();

foreach (DataRow dr in dataTable1)
{
  // ...
}

DataSet has DataSet.HasRow but DataTable doesn’t have such method. If there is no changed rows. changedDT1 will be a null value, causing the loop to throw exception.

How do I check if DataTable is empty? I tried Rows.Count – doesn’t work…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:14:10+00:00Added an answer on May 22, 2026 at 11:14 pm

    If dataTable1 is null, it is not an empty datatable.

    Simply wrap your foreach in an if-statement that checks if dataTable1 is null.
    Make sure that your foreach counts over DataTable1.Rows or you will get a compilation error.

        if (dataTable1 != null)
        {
           foreach (DataRow dr in dataTable1.Rows)
           {
              // ...
           }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dataset for which I need to find the K nearest neighbours,
I have DataSet which has 3 columns. Name - insurance comp. name - treatmentDate
I have a dataset that has two tables in it. I want to do
I am trying to find out what options I have if I wanted to
I have a strongly-typed dataset (VB.NET), using .NET Framework 2.0. Given a DataRow in
This question has two aspects, both related to indices. I have a dataset with
I have an Indian company data set and need to extract the City and
I have a data set of a 1m+ records. I need to output the
I have a couple of numerical datasets that I need to create a concept
I have a dataset something like this: col_a col_b col_c 1 abc_boy 1 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.