I am using ODBC to read data from a pervasive PSQL database and in some scenarios, the date column can contain 00/00/0000 date. I don't really care about invalid dates so is there some way I can convert all of these un-representable dates into Null or some specific date instead of the query failing.
EDIT:
The following shows the code I am using and where it is failing:
Private _connODBC As OdbcConnection
Dim dt As New DataTable
_connODBC = New OdbcConnection(txtConnectionString.Text)
_connODBC.Open()
Dim dataadapter = New OdbcDataAdapter(QueryString, _connODBC)
dataadapter.Fill(dt) '<--- This line throws the unrepresentable date time error
_connODBC.Close()
@SSS got me me thinking that this could be done in the query, although it is a bit long winded:
SELECT CASE CONVERT([updated date], SQL_CHAR)
WHEN '0000-00-00' THEN NULL
ELSE [updated date] END
AS [updated date] FROM fingerscans
Although I would like a solution doesn't rely on me having to remember to do this whenever I read the database!