Haris Agha

Haris Agha

  • NA
  • 5
  • 722

query to fetch data according current date in asp.net C#

Oct 4 2018 12:03 AM
con.Open();
 
SqlCommand cmd1 = new SqlCommand("SELECT [Description] FROM [tbl_Announcements] where Active = 1 AND ([ValidityDate] >= '" +DateTime.Today.ToLongDateString() + "')
 
cmd1.Connection = con;
 
SqlDataReader dr1 = cmd1.ExecuteReader();
while (dr1.Read())
{
k = dr1["Description"].ToString();
}
 
Label2.Text = k;
 
con.Close();
 

Answers (3)