troubleshooting Question

Problem with Date Validation

Avatar of spanish_fly
spanish_fly asked on
.NET ProgrammingC#
27 Comments1 Solution1208 ViewsLast Modified:
Below pasted is the piece of code where I want to display records based on the date range.

Let's say I have a startDate(01/15/2007) and an endDate(01/15/2008) in the format of "MM-DD-YYYY" :

Can anyone give me some inputs as how to handle date validation in this code. I mean the place where I'm concatenating those 4 columns and getting a single date column row by row, I want to have this date validation. If it falls within this range, it shud add to the DataSet as a new row or else no.

Any help would be appreciated. Thanking you in anticipation.

DataSet newPDS = new DataSet();
DataRow row = new DataRow();
//ADM_DATE is DateTime field in DataSet
//Checking whether column is already created or not
if (newPDS.Tables[0].Columns["ADM_DATE"]== null)
      DataColumn dCol = new DataColumn(newPDS.Tables[0].Columns.Add("ADM_DATE", typeof(DateTime), "").ToString());
for(Int32 i = 0; i < newPDS.Tables[0].Rows.Count; i++)
      row = newPDS.Tables[0].Rows[i];
      //Concatenating 4 columns and filling up a date column (ADM_DATE) row by row
      row["ADM_DATE"] = row["CADMMM"] + "/" + row["CADMDD"] + "/" + row["CADMHH"] + row["CADMYY"];
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 27 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 27 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros