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 :












Display Student Information
Enter Date   To          
Student Informations
Stud_IDStud_NameStud_PhoneStud_YearStud_Email
5023013228Partha 9876573200Secondpara@gmail.com
53301117Kshitij Deopa9823456654Thirddpa@gmail.com
660047210Aniket9896094066FirstAniket@gmail.com
770564399Yogesh9070575432Secondes@gmail.com
990959312Rohit9896652048Firstrohit@gmail.com
5005967521Anil9896777978Firstanil@gmail.com

0 comments:

Post a Comment