Click here to Skip to main content
15,890,690 members
Home / Discussions / C#
   

C#

 
QuestionShowing timezone along with time Pin
nitin_ion11-Jun-14 7:59
nitin_ion11-Jun-14 7:59 
AnswerRe: Showing timezone along with time Pin
Pete O'Hanlon11-Jun-14 9:09
mvePete O'Hanlon11-Jun-14 9:09 
QuestionOutput to Promotion LCD from a PC Pin
Jassim Rahma11-Jun-14 4:19
Jassim Rahma11-Jun-14 4:19 
AnswerRe: Output to Promotion LCD from a PC Pin
OriginalGriff11-Jun-14 5:03
mveOriginalGriff11-Jun-14 5:03 
AnswerRe: Output to Promotion LCD from a PC Pin
Dave Kreskowiak11-Jun-14 7:49
mveDave Kreskowiak11-Jun-14 7:49 
AnswerRe: Output to Promotion LCD from a PC Pin
Chris Quinn11-Jun-14 21:17
Chris Quinn11-Jun-14 21:17 
QuestionWinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
Marnus Steyn11-Jun-14 4:14
Marnus Steyn11-Jun-14 4:14 
AnswerRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
PIEBALDconsult11-Jun-14 4:54
mvePIEBALDconsult11-Jun-14 4:54 
"DateTime date = Convert.ToDateTime(rdr["LastContacted"].ToString());"

Don't do that; just cast the value:

DateTime date = (DateTime) rdr["LastContacted"];


However, MySql is able to store "zero dates":

mysql> SELECT MIN(`acquisition`) FROM `v_array`
    -> ;
+--------------------+
| MIN(`acquisition`) |
+--------------------+
| 0000-00-00         |
+--------------------+
1 row in set (0.05 sec)


which can be neither represented in a .net DateTime nor stored in Sql Server

System.Data.DataException: Exception encountered in ExecuteDataTable ---> MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime


I have had to deal with this many times over the last couple of years (Oracle's Date type also exceeds what Sql Server can hold) so what I do is test and replace with NULL:

, CASE WHEN `acquisition`<'1753/1/1' THEN NULL ELSE `acquisition` END `acquisition`

'1753/1/1' is the minimum date that Sql Server (2012) can hold.
http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqldatetime(v=vs.110).aspx[^]

You may choose a different date if you like.
You'll never get very far if all you do is follow instructions.

GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
Marnus Steyn11-Jun-14 5:03
Marnus Steyn11-Jun-14 5:03 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
PIEBALDconsult11-Jun-14 5:29
mvePIEBALDconsult11-Jun-14 5:29 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
Marnus Steyn11-Jun-14 5:38
Marnus Steyn11-Jun-14 5:38 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
Bernhard Hiller11-Jun-14 20:43
Bernhard Hiller11-Jun-14 20:43 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
PIEBALDconsult12-Jun-14 2:39
mvePIEBALDconsult12-Jun-14 2:39 
QuestionGetNetworkUsageAsync() not working in Windows Store App on Windows 8.1 Pin
Sharath C V11-Jun-14 1:58
professionalSharath C V11-Jun-14 1:58 
AnswerRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Pete O'Hanlon11-Jun-14 3:09
mvePete O'Hanlon11-Jun-14 3:09 
AnswerRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Sharath C V11-Jun-14 3:34
professionalSharath C V11-Jun-14 3:34 
AnswerRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Dave Kreskowiak11-Jun-14 3:12
mveDave Kreskowiak11-Jun-14 3:12 
GeneralRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Sharath C V11-Jun-14 3:38
professionalSharath C V11-Jun-14 3:38 
AnswerRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Sharath C V11-Jun-14 3:30
professionalSharath C V11-Jun-14 3:30 
QuestionWhy have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Member 245846710-Jun-14 17:13
Member 245846710-Jun-14 17:13 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Mycroft Holmes10-Jun-14 18:02
professionalMycroft Holmes10-Jun-14 18:02 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Swinkaran10-Jun-14 18:37
professionalSwinkaran10-Jun-14 18:37 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Kornfeld Eliyahu Peter10-Jun-14 20:17
professionalKornfeld Eliyahu Peter10-Jun-14 20:17 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Kumarbs10-Jun-14 20:33
professionalKumarbs10-Jun-14 20:33 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Member 245846711-Jun-14 16:40
Member 245846711-Jun-14 16:40 

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.