none
datetime2 returned by DbConnection.GetSchema("DataTypes") for SQL Server 2005 RRS feed

  • Question

  • Hi,

     

    When retrieving the data types with DbConnection.GetSchema("DataTypes") from an SQL Server 2005 (tested with "full" version and express), I get inconsistent results:

    - With SqlClient provider, the method returns the datetime2 data type,

    - But OleDb provider does not.

    Why is the datetime2 type returned at all? If I understand correctly, datetime2 is new in SQL 2008. I'm testing with 2005.

     

    If you wonder what I'm trying to do: I need to have a generic solution to create a database schema. At the minimum, it must work for SQL Server 2000 and later, and Oracle 9i and later. Jet (Access) and more would be nice.

     

    Thanks,

     

    Matthias

    Tuesday, April 15, 2008 2:52 PM

Answers

  • Just to let you know that I reproduced your problem, filed a bug on your behalf and it was approved for fixing. Thank you for your post!

    Thursday, April 17, 2008 9:01 PM

All replies

  • The funny thing is: Only 4 months ago I saved a list of all types returned by various database systems & ado.net providers. No datetime2. I believe it came with framework 3.0 SP1.

    I would have thought GetSchema asks the database about the types it knows (especially if you think of this other bug: You cannot call GetSchema when the connection has an open transaction).

    Tuesday, April 15, 2008 3:35 PM
  • Thank you for yourfeed back. I'm looking into your issue.

     

    For a database layer generation tool you might want to take a look at http://www.hibernate.org/

    Tuesday, April 15, 2008 9:29 PM
  • Just to let you know that I reproduced your problem, filed a bug on your behalf and it was approved for fixing. Thank you for your post!

    Thursday, April 17, 2008 9:01 PM
  • Thanks, good to know.

    However, I learned from this story to better not rely on the type information provided by GetSchema. I will hard-wire the type mappings for the database systems our application officially supports, and use GetSchema only as a fallback.

     

    Sunday, April 20, 2008 7:22 PM