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

  • SEARCH
  • Home
  • 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 8026315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:27:05+00:00 2026-06-04T23:27:05+00:00

I am trying to search the datatable for non-unique values and I keep getting

  • 0

I am trying to search the datatable for non-unique values and I keep getting this error

Filter expression ‘PROV_NEW’ does not evaluate to a Boolean term.

when I run it.

This is my code:

public class GetData
{
    datalogiclayer.TableSetup dal;
    DataSet ds;

    public delegate void InvalidTableDataDelegate(string ErrorMessage);
    public event InvalidTableDataDelegate InvalidTableData;

    public delegate void SetupDataLoadedDelegate(System.Data.DataSet dv, string TableName);
    public event SetupDataLoadedDelegate SetupDataLoaded;

    public GetData()
    {
        dal = new datalogiclayer.TableSetup();
    }

    public void Update(DataSets.Setup ds)
    {
        try
        {
            string errMsg = string.Empty;

            if (ValidateTable(ds.SETUP_MWPROV, out errMsg))
            {
                dal.UpdateDatabase(ds);
            }
            else
            {
                if (InvalidTableData != null)
                    InvalidTableData(errMsg);
            }
        }
        catch (Exception)
        {
            throw;
        }
    }

    private bool ValidateTable(DataSets.Setup.SETUP_MWPROVDataTable dt, out string TableIssues)
    {
        try
        {
            //NewCode not used for other row
            DataRow[] result = dt.Select("PROV_NEW = ''");
            DataRow[] dupresults = dt.Select("PROV_NEW");
            TableIssues = string.Empty;
            DataTable dtTemp = dt.DefaultView.ToTable(true, "NEW_PROV");

            if (dupresults.Length == 0)
            {
                return true;
            }
            else
            {
                IEnumerable<DataRow> uniqueCodes = dupresults.AsEnumerable().Distinct(DataRowComparer.Default);

                Console.WriteLine("Unique Provider Codes:");

                foreach (DataRow NEW_PROV in uniqueCodes)
                {
                    Console.WriteLine(NEW_PROV.Field<Int32>("PROV_NEW"));
                }

                return false;
            }          
        }
        catch (Exception)
        {
            throw;
        }
    }
}

So as you can see I have it searching for unique rows in the datatable, when the exception is being thrown is when I actually go to save the data. And it gives the error that is up above.

  • 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-06-04T23:27:06+00:00Added an answer on June 4, 2026 at 11:27 pm
            DataRow[] dupresults = dt.Select("PROV_NEW");
    

    The argument for dt.Select is a filter. "PROV_NEW" is not a valid filter as the expression doesn’t result to a boolean value. I believe you’re confusing this with SQL, where you can ask it to select a single column. But you don’t need to do that because later you need to select distinct off of the PROV_NEW column. If you want to make sure the whole row is distinct, then this is all you need to do.

    If you only want compare the PROV_NEW column, you could write a custom equality comparer that looks at only your PROV_NEW column. You can reference your custom comparer when you call distinct with >this version <.

    Alternatively Grant Winney suggested you could use Linq to select only the single column before using distinct. Refer to comments in their answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to search for something on a page but i keep getting this
I am trying to search an XML field within a table, This is not
I've been trying to make a datatable..but the data still does not show although
I'm trying to search a DataTable for a row I know exists. // This
been trying to search the reason for this error for a long time and
Easy question this time. I'm trying to test whether or not a string does
I'm trying to search in a logfile (test1.txt) for the error message. In the
I'm trying to search through this Json array using PHP: {count:2,items:{milestone:[{id:3107,username:TomSmith1,userid:1620602,date:2012-01-12 16:49:26,projectid:804,projectname:TEST PROJECT,reason:Partial payment
I am trying to do a multi column filter as shown in this page
I'm trying to search multiple fields. Something like this: [NSPredicate predicateWithFormat:@(name title contains[cd] %@)

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.