fetch or filter data from date to date



This is A C# Practice code:
        using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.Data;
        using System.Drawing;
        using System.Linq;
        using System.Text;
        using System.Windows.Forms;
        using System.Data.SqlClient;

        namespace dataentry
        {
            public partial class FetchData : Form
            {
                public FetchData()
                {
                    InitializeComponent();
                }
                SqlConnection connn = new SqlConnection("Data Source=.;Initial Catalog=EManage;Integrated Security=True");
                private void button1_Click(object sender, EventArgs e)
                {
                    SqlDataAdapter sdf = new SqlDataAdapter("select * from Register where date between '"+dateTimePicker2.Value.ToString()+"' and '"+dateTimePicker3.Value.ToString()+"'", connn);
                    DataTable sd = new DataTable();
                    sdf.Fill(sd);
                    dataGridView1.DataSource = sd;
                }
            }
        }
Video For Result:

Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Facebook Comment