Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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 28-Apr-13 20:41pm
saimm675
Edited 28-Apr-13 20:45pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Sounds like you are trying to convert date to empty string. It's not possible!
Try this:
Cus.PSMCReceiveDate = Dr("PSMCReceiveDate").Value
or
Cus.PSMCReceiveDate = Date.TryParse(Dr("PSMCReceiveDate").Value, Date.MinValue)
More:
Date Data Type[^]
Constant and Literal Data Types[^]
DateTime.TryParse[^]
  Permalink  
v2
Comments
saimm at 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 at 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)

  Print Answers RSS
0 OriginalGriff 230
1 PIEBALDconsult 150
2 DamithSL 125
3 Andreas Gieriet 90
4 Jochen Arndt 90
0 OriginalGriff 5,790
1 DamithSL 4,601
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,195


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 29 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100