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 7729783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:03:33+00:00 2026-06-01T06:03:33+00:00

I wish to insert a Date value in DataRow[] and find a DateTime value

  • 0

I wish to insert a Date value in DataRow[] and find a DateTime value in a column. The Date value entered will be passed to a var to perform another search. But it cannot be passed, can any1 help me fix my code?

//Receive StartDateTime value
DataRow[] setStartDateTime = DataSet1
            .Tables["table1"]
            .Select("StartDateTime =#" + searchMonth + "/" + searchDay + "/" + searchYear + "#");

//Count PcrID rows which same row with StartDateTime
var PcrID_1 = DataSet1
            .Tables["table1"]
            .AsEnumerable()
            .Where(c => c.Field<DateTime>("StartDateTime") == setStartDateTime) /*Error occurs here: Operator '==' cannot be applied to operands of type 'System.DateTime' and 'System.Data.DataRow[]'*/
            .Select(d => d["PcrID"]);

Pcr_1 = PcrID_1.Count();      
  • 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-01T06:03:34+00:00Added an answer on June 1, 2026 at 6:03 am

    Once you filtered rows by date-time you need to apply Select on that bunch of rows. For example,

    var PcrID_1 = setStartDateTime.Select(d => d["PcrID"]);
    Pcr_1 = PcrID_1.Count();      
    

    Of course , above code doesn’t make sense if all you want is the count then you can very well do that by saying

    Pcr_1 = setStartDateTime.length;
    

    Or you can do the original filtering using LINQ – for example,

    var searchDate = new DateTime(searchYear, searchMonth, searchDay);
    var PcrID_1 = DataSet1.Tables["table1"].AsEnumerable()
                      .Where(c => c.Field<DateTime>("StartDateTime") == searchDate)
                      .Select(d => d["PcrID"]);
    

    The first and last example code actual produces enumeration of PcrID for the given date.
    If you want a distinct list then you can use Distinct extension method – for example

     var ids = DataSet1.Tables["table1"].AsEnumerable()
                          .Where(c => c.Field<DateTime>("StartDateTime") == searchDate)
                          .Select(d => d["PcrID"]).Distinct();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to perform date manipulation of an imported csv file with the first
I wish to view my column time as 'hh24:mi:ss' but even i insert it
in MATLAB i wish to insert a value half way between every element in
I wish to DELETE the data from a table before performing an INSERT INTO,
I can insert annotations on specific datasets on the graph but I wish to
I wish to use sp_start_job to start a job from within an insert trigger
I wish to Insert or Update a row in a table - so I
I have looked around and have yet to find a decent answer. I wish
I want to ask is it possible to insert your own value in the
Below shows a executable statement: Successful attempt: INSERT INTO Personnel_Assignment (DATE, testno, Hours) SELECT

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.