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;
- }
- }
- }
Facebook Comment