In our project we insert date to our database table through Textbox or through AJAX calender extender of through calender control. But the default format of table is "MM/dd/yyyy". It gives error when we send date in a incorrect format . So I am explaining the way which will not fail ever
string[] date = TxtDate.Text.Split(new char[] { '/' });
string NewDate = date[1] + "/" + date[0] + "/" + date[2];
Insert into Table (JoinDate) values ('"+NewDate+"' );
No comments:
Post a Comment