I am trying to save a date from my Angular ui-Datepicker to my SQL database. The date is in the format (10-27-2015 12:00 AM) but it will not save. I tried using the following to convert it to SQL DateTime format:
DateTime? myDate = form.dteStartDate;
string sqlFormattedDate = myDate.ToString("yyyy-MM-dd HH:mm:ss");
But I receive the error "No overload for method 'ToString' takes 1 arguments. The field in SQL is type 'datetime'.
Any assistance is greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…