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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:41:22+00:00 2026-05-29T17:41:22+00:00

How can I get an array of datatable row numbers which meet a certain

  • 0

How can I get an array of datatable row numbers which meet a certain criteria? For example I have a datatable with a column “DateTime”. I want to retrieve the row numbers of the datatable where “DateTime” equals the variable startTime.

I know how to retrieve the actual row, but not the number of the row in the datatable.

Any help will be appreciated 🙂

  • 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-29T17:41:25+00:00Added an answer on May 29, 2026 at 5:41 pm

    If I am reading the question right, using the overload of Select that allows a second input for the index may work for you. Something like

    var indices = 
        table.AsEnumerable()
             .Select((row, index) => new { row, index })
             .Where(item => item.row.Field<DateTime?>("DateTime") == startTime)
             .Select(item => item.index)
             .ToArray();
    

    If that date matches on the first, third, and sixth rows, the array will contain indices 0, 2, and 5. You can, of course, add 1 to each index in the query if you would like row numbers to start at 1. (ex: .Select(item => item.index + 1))

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

Sidebar

Related Questions

If I have an array as $keys => $values , how can I get
I have a multi select dropdown list. I can get the array of selected
I have a <ice:dataTable> and I want to add a checkbox to each row.
I have a array of string say: String[] Fields=new String[]{RowField,RowField1} In which I can
i want to make my table can filtering in each column. i get client
Please tell me how can I get array of all Those DIV of specific
How can I get an array of values from an associative array ? Associate
how can i get elements uniquely from an array
how can i get [user_id] from this array? Array ( [2] => cbpaidSubscription Object
How can I get the last key of an array?

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.