Posted on: 3/10/2015 3:26:50 PM | Views : 765

I have some code that reads the database and should reload a form.
But I can't seem to convert the text field to accept the datetime field.

var iD = Request.QueryString["Id"]; var item = db.tblDownloads.FirstOrDefault(x => x.DocumentId == Convert.ToInt32(iD)); item.CategoryId = Convert.ToInt32(ddl_category.SelectedValue); item.DocumentTitle = txt_document_title.Text; item.UploadDate = Convert.ToDateTime(txt_document_date.Text);// throws error cannot convert string to datetime item.Link = txt_link.Text; Should I be trying to `tryParse` some how

Go to the complete details ...