datatypes of DOB is datetime and age is in int .when i m trying to wrote like this i found a error like input sting is not in correct formate
public ActionResult AddTrainer(Tbl_Trainer _obj, HttpPostedFileBase file)
{
var thisyear = DateTime.Now.Year;
var birthyear = _obj.Dateofbirth;
// int age = (Int32.Parse(thisyear) - Int32.Parse(birthyear.ToString())) / 10000;
int age = (int)thisyear - int.Parse(_obj.Dateofbirth.Value.ToString())/1000;--input sting is not in correct formate
int outletid=(int) Session["id"];
if (file != null && file.ContentLength > 0)
{
BinaryReader br = new BinaryReader(file.InputStream);
var filename = Path.GetFileName(file.FileName);
int filelength = filename.Length;
byte[] filedata = br.ReadBytes((int)file.InputStream.Length);
int i = _Dalobj.AddTrainer(outletid,_obj, filedata, age);
if (i == 1)
{....
...}
TIA