Click here to Skip to main content
12,071,956 members (60,780 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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
saimm726
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 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 29 Apr 2013
Copyright © CodeProject, 1999-2016
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