My connection string to the DB has the Allow Zero Datetime=True; The whole program works perfectly, the only problem is that Date does not.
I tested the same program with an access DB and it works flawlessly. This issue only happens on MySQL DB that is necessary for my project.
This is an insert statement that I have only my DB under a history table
SqlVentaCasas = "INSERT INTO VentaCasasHistory (ID, Direccion, Estatus, Precio, " & _
"NumeroDias, FechaHoy, Agente, Compania, Unidad, Ciudad ) VALUES ('" & _
AddIDCasas2 & "','" & AddDireccionCasas2 & "','" & AddEstatusCasas2 & "'," & AddPrecioCasas2 & ", " & NumeroDiasCasas2 & " ,'" & _
Date.Today & "','" & AgenteNameCasas2 & "','" & AgenteCompaniaCasas2 & "', '" & AddUnidadCasas2 & "', '" & AddCiudadCasas2 & "' );"
The date shows as 0000-00-00 in my .net windows application. How can I resolve it?
Try changing
Date.TodaytoDate.Today.ToString("yyyy-MM-dd"). I believe the default date format isMM/dd/yyyyforDate.Todaywithout any format string which MySQL may not like in this instance.