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; namespace WebApplication1 { public partial class dob : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=ADMIN-PC;Initial Catalog=testdb;User ID=sa;Password=Klogwiy8"); con.Open(); SqlCommand com = new SqlCommand("insert into dob values('"+txtName.Text+"','','"+txtDOB.Text+"')"); com.Connection = con; com.ExecuteNonQuery(); con.Close(); } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("show58.aspx"); } protected void Button3_Click(object sender, EventArgs e) { String Bir = txtdob2.Text; DateTime birth = Convert.ToDateTime(Bir); DateTime present = DateTime.Now; TimeSpan ts = birth - present; DateTime age = DateTime.MinValue.AddDays(ts.Days); Response.Write("Current age is : "+age.Year+" years " +age.Month+ " Months "+age.Day+" Days"); if (age.Year > 58) { Response.Write("This Employee has retired"); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)