Avatar of Moti Mashiah
Moti Mashiah
Flag for Canada asked on

windows form

Hi guys ,

I have build some windows form application and I'm trying to query data by dates for example:

from: datetimepicker1 - To: datetimepicker2 - "button to query to grid"

please see attachment and here is my code:

private void button1_Click(object sender, EventArgs e)
        {
            ALThompsonCRMEntities db = new ALThompsonCRMEntities();

            string dt1 = Convert.ToString(dateTimePicker1); 
            string dt2 = Convert.ToString(dateTimePicker2);

            var tds = (from h in db.altcrm_error_log where h.error_date == Convert.ToDateTime(dt1) && h.error_date == Convert.ToDateTime(dt2) select new { h.error_date});

            dataGridView1.DataSource = tds.ToList();

        }[embed=file 905435]

Open in new window

Capture.JPG
C#.NET Programming

Avatar of undefined
Last Comment
Moti Mashiah

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
David Johnson, CD

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Moti Mashiah

ASKER
I can't get what you are suggest, please can you be more clear.

I was trying this code and it doesn't work.


Thanks.
Moti Mashiah

ASKER
k, i got the point and your solution fixed my problem thx.
Moti Mashiah

ASKER
Great solution thx.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck