C
C
Chronzy2017-12-05 16:31:09
Knowledge base
Chronzy, 2017-12-05 16:31:09

How to add date to dataGridView?

Let the table have a certain date for each record, you need to display the records that are in the interval of given dates.
Can someone tell me how to do it? An example is desirable so that it is clear without questions
PS the table is not organized by sql

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Arxont, 2017-12-06
@arxont

There are several ways to do this, but I would recommend that you bind a BindingSource and use the Filter property.

testBindingSource.Filter = 
   $"DateTimeColumn >= #{DateTime.Now.AddMonths(-1):MM/dd/yyyy}# AND DateTimeColumn <= #{DateTime.Now:MM/dd/yyyy}#";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question