Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Convert Date into String for DataReaderValue

My Code is >>
Cus.PSMCReceiveDate = GetNullString(Dr("PSMCReceiveDate"))

And Error on this Point
Conversion from string "" to type 'Date' is not valid.

what should i do for convert here
>>> Dr = SqlDataReader
And In SQL TABLE THIS COLUMN =
PSMCReceiveDate	datetime	Checked
Posted
Updated 28-Apr-13 19:45pm
v2

1 solution

Sounds like you are trying to convert date to empty string. It's not possible!
Try this:
VB
Cus.PSMCReceiveDate = Dr("PSMCReceiveDate").Value

or
VB
Cus.PSMCReceiveDate = Date.TryParse(Dr("PSMCReceiveDate").Value, Date.MinValue)

More:
Date Data Type[^]
Constant and Literal Data Types[^]
DateTime.TryParse[^]
 
Share this answer
 
v2
Comments
saimm 29-Apr-13 3:14am    
Yes U R Right i Pass Null Value
But What Should I Do Here that Null Value Make No error
Maciej Los 29-Apr-13 3:23am    
Sorry, i do not understand you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900