Click here to Skip to main content
15,896,435 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Not Active8-Jan-09 7:23
mentorNot Active8-Jan-09 7:23 
AnswerRe: Error converting data type nvarchar to datetime, any suggestion Pin
musefan8-Jan-09 5:37
musefan8-Jan-09 5:37 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 5:51
suni_dotnet8-Jan-09 5:51 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
musefan8-Jan-09 6:03
musefan8-Jan-09 6:03 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 6:29
suni_dotnet8-Jan-09 6:29 
AnswerRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 6:15
Jon Rista8-Jan-09 6:15 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Not Active8-Jan-09 6:31
mentorNot Active8-Jan-09 6:31 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 7:31
Jon Rista8-Jan-09 7:31 
Actually, there absolutely is a point to the cast. Test it for yourself:

string raw = null;
DateTime? dt = (String.IsNullOrEmpty(raw) ? null : Convert.ToDateTime(raw));

You will get the following compilation error:

Type of conditional expression cannot be determined because there is no implicit conversion between '<null>' and 'System.DateTime'

Yes, you are correct, checking for null is not sufficient, checking String.IsNullOrEmpty() is correct. That wasn't the real point of my response, though. But check that ternary statement...there absolutely is a point to that cast, its reqired to compile.
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Not Active8-Jan-09 8:06
mentorNot Active8-Jan-09 8:06 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 8:16
Jon Rista8-Jan-09 8:16 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 6:55
suni_dotnet8-Jan-09 6:55 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 7:34
Jon Rista8-Jan-09 7:34 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 7:53
suni_dotnet8-Jan-09 7:53 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 8:06
Jon Rista8-Jan-09 8:06 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 8:28
suni_dotnet8-Jan-09 8:28 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 9:12
Jon Rista8-Jan-09 9:12 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 9:49
suni_dotnet8-Jan-09 9:49 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 10:17
Jon Rista8-Jan-09 10:17 
QuestionEventhandle !!! Pin
RongNK8-Jan-09 4:36
RongNK8-Jan-09 4:36 
AnswerRe: Eventhandle !!! [modified] Pin
Wendelius8-Jan-09 4:41
mentorWendelius8-Jan-09 4:41 
GeneralRe: Eventhandle !!! Pin
RongNK8-Jan-09 5:05
RongNK8-Jan-09 5:05 
GeneralRe: Eventhandle !!! Pin
Wendelius8-Jan-09 5:33
mentorWendelius8-Jan-09 5:33 
AnswerRe: Eventhandle !!! Pin
Le centriste8-Jan-09 4:44
Le centriste8-Jan-09 4:44 
GeneralRe: Eventhandle !!! Pin
Luc Pattyn8-Jan-09 5:04
sitebuilderLuc Pattyn8-Jan-09 5:04 
QuestionShortcuts aint working when MultiLine is true Pin
Xmen Real 8-Jan-09 4:16
professional Xmen Real 8-Jan-09 4:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.