Date/Time columns and SqliteCommandBuilder

  • I have a column that stores a dateTime.  The problem is, when I am using the command builder, the command builder reads the schema from the database and so sees that column type as TEXT so when inserting or updating, the parameter type is DbType.String instead of DbType.DateTime.

    I solved this by editing the SqliteCommandBuilder.GenerateSchema() function to set the "ProviderType" column on the schema.  I added some code to the command builder like..

    private ArrayList dateList;

    public sub AddDateColumn(string colName) {

    and then at the end of GenerateSchema()

    for each (DataRow row in mpSchema.Rows) {
      if (this.dateList.Contains(row["ColumnName"])
        row["ProviderType"] = DbType.DateTime;

    While this works fine, I was wondering if there was a more elegant solution than this hack to allow user code to override the provider types for the schema.  Some way to use the data types of the associated DataSet?   If not, perhaps this could be a possible enhancement?