Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi......
plz send code for alert message before 30 days of expiry date in c#.
plz reply me.....
Posted
Comments
Aydin Homay 1-Jun-13 1:14am    
Please tell me what you want exactly ?

1 solution

string d1 = DateTime.Today.ToString("yyyy-MM-dd");
string d2 = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd");
string constr = ConfigurationManager.AppSettings("DEFAULT_PATH").ToString();
SqlConnection con = new SqlConnection(constr);
string sql = "SELECT COUNT (vehicleid) FROM vehicle_master WHERE PUC>='" + d1 + "' and PUC<='" + d2 + "'";
con.Open();
SqlCommand cmd = new SqlCommand(sql, con);
int temp = Convert.ToInt32(cmd.ExecuteScalar().ToString());

con.Close();
if ((temp > 0)) {
gvpuc.Visible = true;
DataTable dt = new DataTable();
string constr1 = ConfigurationManager.AppSettings("DEFAULT_PATH").ToString();
SqlConnection con1 = new SqlConnection(constr1);
string sql1 = "SELECT * FROM vehicle_master WHERE PUC>='" + d1 + "' and PUC<='" + d2 + "'";
SqlCommand cmd1 = new SqlCommand(sql1, con1);
con1.Open();
SqlDataReader dr1 = cmd1.ExecuteReader;
dt.Load(dr1);
gvpuc.DataSource = dt;
gvpuc.DataBind();
lblmsg.Visible = true;
lblmsg.Text = "PUC Due to Expire.";
} else {
gvpuc.Visible = false;
lblmsg.Visible = true;
lblmsg.Text = "No PUC that are Due to Expire.";
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900