seiamerica
Technical User
I have a field in sql server database defined as smalldatetime. In my C# application I am selecting a date from calendar into a textbox and trying to convert the textbox value into datetime and putting back to database. I get this message all the time.
Error adding item. Please check fields.System.FormatException: String was not recognized as a valid DateTime. this is the code I am using to convert.
string test = textbox1.text;
DateTime dt = System.Convert.ToDateTime(test);
and trying to insert dt into database.
unable to get rid of this error.
Any help is appreciated.
Error adding item. Please check fields.System.FormatException: String was not recognized as a valid DateTime. this is the code I am using to convert.
string test = textbox1.text;
DateTime dt = System.Convert.ToDateTime(test);
and trying to insert dt into database.
unable to get rid of this error.
Any help is appreciated.