Compare Two Dates in Between SQL Query Using DateTimePicker Jquery Calender in Asp.Net C#

Compare Two Dates in Between SQL Query

Compare Two Date Values with SQL Between Command Query Using DataTime Picker  JQuery Calender Control Using in Asp.Net C#.

Jquery Calender View Format,Month,Year 

Jquery Calender With TextBox

Jquery DatePicker with Textbox Using Asp.Net C#
Calender Control DatePicker Using JQuery
Show PopUp Window Open DateTimePicker


                            HTML CODING

<html xmlns="">
<meta charset="utf-8">
<title>jQuery UI Datepicker - Default functionality</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
     <link rel="stylesheet" href="">
    <script src=""></script>
    <script src=""></script>

    <script type="text/javascript" lang="javascript">
        $(function () {
            $("#<%=txtFrom.ClientID %>").datepicker({
                changeMonth: true,
                changeYear: true,
                chandeDate: true
        $(function () {
            $("#<%=txtTo.ClientID %>").datepicker({
                 changeMonth: true,
                 changeYear: true,
                 chandeDate: true

<form id="form1" runat="server">

    <asp:Label ID="Label1" runat="server" Text="From Date "></asp:Label>
<asp:TextBox ID="txtFrom" runat="server"></asp:TextBox>
    <asp:Label ID="Label2" runat="server" Text="To Date"></asp:Label>
    <asp:TextBox ID="txtTo" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
</td><td><asp:GridView ID="GridView1" runat="server">
       <AlternatingRowStyle BackColor="#9999FF" />
      <HeaderStyle BackColor="#FF3300" />
            <RowStyle BackColor="Silver" />


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data.OleDb;
using System.Data;
using System.Data.SqlClient;

public partial class Default4 : System.Web.UI.Page
    SqlConnection con;
    public void dbcon()
        string connn = (System.Configuration.ConfigurationManager.ConnectionStrings["dbcon"].ToString());
        con = new SqlConnection(connn);
    protected void Page_Load(object sender, EventArgs e)
    protected void Button1_Click(object sender, EventArgs e)
        SqlCommand cmd = new
  SqlCommand("Select report_date as[Dates],name as [Names] from dates where report_date between '"+txtFrom.Text+"' and '"+txtTo.Text+"'",con);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        SqlDataReader rd = cmd.ExecuteReader();
        if (rd.Read())
            GridView1.DataSource = dt;

First  - Add New WebForm - Add GridView - Textbox For Input Date From ToolBox

Next - Add JQuery DateTimePicker For Two TextBoxes

Next - Add Between Sql Command For Compare Two Date Database Table 

Next - Run[F5]  - Compare Two Dates  - Show Result


Post a Comment