cmd = new OleDbCommand("update valid set date1="+ dateTimePicker1.Value.ToOADate() +" where id='"+ 1 +"'",con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
da = new OleDbDataAdapter("select * from valid", con);
dt = new DataTable();
da.Fill(dt);
DateTime dd = Convert.ToDateTime(dt.Rows[0][1].ToString());
DateTime dd1 = Convert.ToDateTime(dt.Rows[0][2].ToString());
TimeSpan dd2 = dd1 - dd;
int dd3 = Convert.ToInt32(dd2.TotalDays);
if (dd3 >= 0)
{
label1.Text = "You Have " + dd3 + " Days Left";
}
else
{
label1.Text = "Your Valid Time is Expired";
menuStrip1.Visible = false;
}
con.Open();
cmd.ExecuteNonQuery();
con.Close();
da = new OleDbDataAdapter("select * from valid", con);
dt = new DataTable();
da.Fill(dt);
DateTime dd = Convert.ToDateTime(dt.Rows[0][1].ToString());
DateTime dd1 = Convert.ToDateTime(dt.Rows[0][2].ToString());
TimeSpan dd2 = dd1 - dd;
int dd3 = Convert.ToInt32(dd2.TotalDays);
if (dd3 >= 0)
{
label1.Text = "You Have " + dd3 + " Days Left";
}
else
{
label1.Text = "Your Valid Time is Expired";
menuStrip1.Visible = false;
}
No comments:
Post a Comment