如何将Date转换为DataReaderValue的字符串 [英] How Convert Date into String for DataReaderValue
本文介绍了如何将Date转换为DataReaderValue的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将日期转换为DataReaderValue的字符串
我的代码是>>
Cus.PSMCReceiveDate = GetNullString(Dr(PSMCReceiveDate))
此点错误
从字符串转换为类型''日期''无效。
我该怎么做才能转换到这里
>>> Dr = SqlDataReader
并在SQL TABLE中此列=
PSMCReceiveDate datetime已检查
解决方案
听起来你正试图将日期转换为空字符串。这是不可能的!
试试这个:
Cus.PSMCReceiveDate = Dr( PSMCReceiveDate)。值
或
Cus.PSMCReceiveDate = 日期 .TryParse(Dr( PSMCReceiveDate)。值,日期 .MinValue)
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
解决方案
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[^]
这篇关于如何将Date转换为DataReaderValue的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文