System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 5b0c43fec967c5f19a5b79da8f997432bd6a617a
Title: An problem about System.Data.SQLite.SQLiteDataAdapter.Fill
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Convert Resolution: Works_As_Designed
Last Modified: 2018-04-04 04:44:13
Version Found In: 1.0.108.0
User Comments:
anonymous added on 2018-04-03 03:03:35:
Question on stackoverflow
https://stackoverflow.com/questions/49608629/an-empty-string-in-a-column-of-type-timestamp-caused-unreadable
Maybe should need some elegant solutions - this error is not common, but it may cause great trouble
1. Add some overloads for Fill method, add a argument to set ignore or not the convert error / ignore error data row
2. Add some convert controler, can let user set the custome convert way
3. …

anonymous added on 2018-04-04 03:17:48:
You mark this issue as WAD. So, can you provide a feasible solution, please?

mistachkin added on 2018-04-04 04:40:41:
There are several possible solutions.  One is to change the type of the column
so that the System.Data.SQLite type conversion subsystem does not try to see it
as a DateTime.

Another is to disable all type conversions for the associated connection using
the "GetAllAsText" connection flag, e.g.:

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=test.db;Flags=GetAllAsText"))
          {
            connection.Open();

            // ...
          }

Alternatively, you could use the "UseConnectionReadValueCallbacks" connection
flag and implement a custom SQLiteReadValueCallback to change the value into
something that is a DateTime.

Finally, you could modify the type mappings for the connection to map the
"TIMESTAMP" type to a string instead of a DateTime.  See "AddTypeMapping" in
the help file.

mistachkin added on 2018-04-04 04:44:13:
Example of a read value callback:

https://stackoverflow.com/questions/40003272