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 DatePicker with Textbox Using Asp.Net C#
DEMO
Compare Two Date Values with SQL Between Command Query Using DataTime Picker JQuery Calender Control Using in Asp.Net C#.
Jquery DatePicker with Textbox Using Asp.Net C#
Calender Control DatePicker Using JQuery
Show PopUp Window Open DateTimePicker
DEMO
HTML CODING
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></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
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<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" />
</asp:GridView></td></tr></table></div></form></body></html>
C# CODING
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);
con.Open();
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
dbcon();
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();
adp.Fill(dt);
SqlDataReader rd = cmd.ExecuteReader();
if (rd.Read())
{
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
}
0 comments:
Post a Comment