I am badly stuck with inserting and retrieving Date in SQL DB from C#. I have a C# application which needs to save date in SQL 2008 Database for various purposes.
The format in DB is DateTime for my DateColumn and i am using Datetime Picker in my c# application to get the date from user and save it in database.
I have tried all sorts of formats, however, unfortunately i cant get the program to save the date in the database correctly, it saves as some random date mainly 1900-1-1 or 1905 ... from somewhere
I have tried:
this.dtpDOB.text and splitted into tokens and then saved it
string origDate = this.dtpDOB.Value.ToShortDateString();
string dateTokens = origDate.Split('/');
string sqlDate = dateTokens + "-" + dateTokens + "-" + dateTokens;
and i have also tried
Please Help As soon as possible