Link to home
Start Free TrialLog in
Avatar of Moti Mashiah
Moti MashiahFlag 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
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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.
k, i got the point and your solution fixed my problem thx.
Great solution thx.