Using .NET Typed DataSet’s with Oracle and SQL-Server

One thing to be aware of if you plan to use typed datasets with Oracle and SQLServer, is the way in which Oracle and SQL Server handle type mapping for Numeric types.

A SQL Server INT is mapped to an Int32 when using the SQL Server provider, however an Oracle NUMER(10,0) is mapped to an Int64 when using the Oracle ODP provider. I haven’t tried it but I suspect that if I changed to Oracle NUMBER type to NUMBER(9,0) it might then map to an Int32, but thats a lot of changes and NUMBER(10,0) is something of a standard, at least where I’m working now.

Anyway I only mention this because its caught me out too many times, my solution is to change the schema of the typed dataset from Int to Long, SQL Server is happy because it’s promoting an Int to a Long, Oracles happy because there is no typed conversion issue.

Published by

Phil Harding

SharePoint Consultant, Developer, Father, Husband and Climber.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.