I need your help to figure out and maybe solve this problem.
I have a DataReader and when use the function GetDateTime, to read a Date column, I get the min value. I don't see a GetDate function. I tried changing the datatype of the column to Datetime, in order to both have the same datatype, but it's the same result.
This is the definition of the table:
CREATE TABLE [dbo].[Solped](
[docNumber] [int] NOT NULL,
[docType] [nvarchar](255) NOT NULL,
[createDate] [date] NULL,
[hora] [time](2) NULL,
....
This is where I read the database:
string sql = "SELECT * FROM Solped order by docNumber DESC";
System.Console.WriteLine(sql);
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
solped = new Solped();
solped.docNumber = reader.GetInt32(0);
solped.docType = reader.GetString(1);
DateTime dt = reader.GetDateTime(2);
solped.fecha = dt;
This is the value presented when debbuging:
dt = {1/1/0001 12:00:00 AM}
And this is the presented value in the program:
Date(1345089600000)
I am totally confused about that I don't know what function or actions should I take to solve the problem. If you may help, I would greatly appreciate that. Thanks!