Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am displayed date without using db...using this code
C#
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[1] { new DataColumn("Datess") });
ViewState["Customers"] = dt;
DateTime startDate = new DateTime(2015, 1, 26);
DateTime stopDate = new DateTime(2015, 2, 28);
int interval = 1;

for (DateTime dateTime = startDate; dateTime < stopDate; dateTime += TimeSpan.FromDays(interval))
{
dt.Rows.Add(startDate);
startDate = startDate.AddDays(interval);
ViewState["Customers"] = dt;
}
GridView1.DataSource = (DataTable)ViewState["Customers"];
GridView1.DataBind();
o/p is like this....
date
26/1/2015
..
....
27/2/2015

then i want to compare these date with my database table DATE
my database is
date       42 43 47 78
29/1/2015   p  p  A  P
2/2/2015    A  P  P   A

i want to compare these two date and display like this
date       42 43 47 78
26/1/2015
27/1/2015
28/1/2015
29/1/2015   p  p  A  P
30/1/2015
31/1/2015
2/2/2015    A  P   P   A
.....
...
27/2/2015
Posted
Updated 19-Jan-15 2:36am
v2
Comments
CHill60 19-Jan-15 8:36am    
What have you tried? Where are you stuck?

1 solution

how to compare the date....
my database date and gridview date
 
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