hi
I have a DateInput and i have the date format set to dd/MM/yyyy. I have also keyed in a date as 16/09/1970 and my table field DateOfBirth is of Date dataype in MSSQL.
But it just kept giving me this error "String was not recognized as a valid DateTime."
What is wrong? thanks
I have a DateInput and i have the date format set to dd/MM/yyyy. I have also keyed in a date as 16/09/1970 and my table field DateOfBirth is of Date dataype in MSSQL.
But it just kept giving me this error "String was not recognized as a valid DateTime."
What is wrong? thanks
4 Answers, 1 is accepted
0

Jose
Top achievements
Rank 2
answered on 03 May 2011, 03:47 AM
Hi L.
Could you paste the code here to check it out?
thanks.
Jose
Could you paste the code here to check it out?
thanks.
Jose
0

L
Top achievements
Rank 1
answered on 03 May 2011, 04:45 AM
hi
here is my code:
Sub methodA(byVal DOB as Date)
sqlcmd.Parameters.Add(New SqlParameter("@DOB", SqlDbType.Date)).Value = DOB
ExecuteNonQuery
End Sub
methodA(txtDOB.Text)
the txtDOB is a radDateInput and the DOB is a Date datatype in a table field. Thanks
0
Accepted

Jose
Top achievements
Rank 2
answered on 03 May 2011, 05:14 AM
Hi L.
Normally you would call something like:
methodA(txtDOB.SelectedDate.Value)
The reason is that the property "Text" will return the text representation of the date while SelectedDate will return the selected date as a nullable DateTime. Most likely you will also need to check wether txtDOB.SelectedDate.HasValue is true and return txtDOB.SelectedDate.Value.
Let me know if that helped. (and mark it as answer ;) )
Jose
Normally you would call something like:
methodA(txtDOB.SelectedDate.Value)
The reason is that the property "Text" will return the text representation of the date while SelectedDate will return the selected date as a nullable DateTime. Most likely you will also need to check wether txtDOB.SelectedDate.HasValue is true and return txtDOB.SelectedDate.Value.
Let me know if that helped. (and mark it as answer ;) )
Jose
0

L
Top achievements
Rank 1
answered on 03 May 2011, 05:27 AM
hi Jose
thanks a lot. It is working fine now. Thanks
thanks a lot. It is working fine now. Thanks