c# - Best practices for getting around DB differences with an IDataReader -


I have a simple value object that I populate with data from idata reader (either for an oracle The query may be the result or MS SQL database). The factory method for this object looks like the following:

  Fixed some class CreateFromDataReader (IDataReader data) {string message = data.GetString (0); Short ID = data. GetInt 16 (1); Date Time = DateType = Data. Gateadet Time (2); Returned a new class (message, id, datestamp); }  

Then I went into a problem that is related to the difference in the data type, which uses the Oracle and MS SQL databases for that particular column: the data type in the oracle Number while

  lower id = convert. ToInt16 (now), when I can fix this problem:  

data.GetValue (1));

Is there a better or more excellent way to do this?

I do not know how ORM does the focus of such a scenario.

However, you should use a type that can accommodate both (all) cases for such an area.
I saw; It seems that the decimal is the appropriate appropriate data type that you can use.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -