The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. The statement has been terminated.
-
Hi, i am a fresher.i am trying to insert values using front end,i am getting error The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. The statement has been terminated. During table creation for Date i used datetime datatype. in front end design i used code like this. Insert into Invoice(date) values('" + _Date + "'); i am using the DataGrid to Display the table in same page, i tried to give the date in both the format 1/2/2013 and 2013/01/02 but the error. plz help me to solve this Problem. plz provide the simple code to datetime conversion.
-
Hi, i am a fresher.i am trying to insert values using front end,i am getting error The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. The statement has been terminated. During table creation for Date i used datetime datatype. in front end design i used code like this. Insert into Invoice(date) values('" + _Date + "'); i am using the DataGrid to Display the table in same page, i tried to give the date in both the format 1/2/2013 and 2013/01/02 but the error. plz help me to solve this Problem. plz provide the simple code to datetime conversion.
-
Hi, i am a fresher.i am trying to insert values using front end,i am getting error The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. The statement has been terminated. During table creation for Date i used datetime datatype. in front end design i used code like this. Insert into Invoice(date) values('" + _Date + "'); i am using the DataGrid to Display the table in same page, i tried to give the date in both the format 1/2/2013 and 2013/01/02 but the error. plz help me to solve this Problem. plz provide the simple code to datetime conversion.
You are doing a number of things wrong. You should use a datepicker instead of a textbox, this will help you control the format of your data, ALWAYS use the DATETIME data type, NEVER use varchar/string for datetime data. Learn to use parameterised queries[^] they will make you life a lot simpler and eliminate the data type issue (oh and make your code more secure). Instead of editing into a datagrid I recommend you use a detail control or a dialog to do your data entry, this give you much greater control easier to manage.
Never underestimate the power of human stupidity RAH