entry.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class entrydate : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label2.Text = "";
SqlConnection con = new SqlConnection(DataBase.connect);
SqlDataAdapter da = new SqlDataAdapter("select * from Stud_Info where Entry_Date Between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'", con);
SqlCommandBuilder cm = new SqlCommandBuilder(da);
DataSet ds = new DataSet();
da.Fill(ds, "Stud_Info");
if (ds.Tables["Stud_Info"].Rows.Count > 0)
{
Label3.Text = "Student Informations";
GridView1.DataSource = ds.Tables["Stud_Info"];
GridView1.DataBind();
}
else
Label2.Text = "Record Not found ";
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
Demo :
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class entrydate : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label2.Text = "";
SqlConnection con = new SqlConnection(DataBase.connect);
SqlDataAdapter da = new SqlDataAdapter("select * from Stud_Info where Entry_Date Between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'", con);
SqlCommandBuilder cm = new SqlCommandBuilder(da);
DataSet ds = new DataSet();
da.Fill(ds, "Stud_Info");
if (ds.Tables["Stud_Info"].Rows.Count > 0)
{
Label3.Text = "Student Informations";
GridView1.DataSource = ds.Tables["Stud_Info"];
GridView1.DataBind();
}
else
Label2.Text = "Record Not found ";
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
Demo :
Display Student Information | ||||||||||||||||||||||||||||||||||||||
Enter Date | To | |||||||||||||||||||||||||||||||||||||
Student Informations | ||||||||||||||||||||||||||||||||||||||
|
0 comments:
Post a Comment