This is a migrated thread and some comments may be shown as answers.

RADDateinput error

4 Answers 47 Views
Input
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 02 May 2011, 08:15 AM
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

4 Answers, 1 is accepted

Sort by
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
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
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
Tags
Input
Asked by
L
Top achievements
Rank 1
Answers by
Jose
Top achievements
Rank 2
L
Top achievements
Rank 1
Share this question
or