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
saimm665
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 BillWoodruff 360
1 Mathew Soji 309
2 DamithSL 225
3 Afzaal Ahmad Zeeshan 202
4 Maciej Los 190
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.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