[Mono-list] Bug (?) in SqliteDataReader

Nikki Locke nikki at trumphurst.com
Tue May 16 10:30:03 EDT 2006


T Senganal wrote:
> >>> Joshua Tauberer <tauberer at for.net> 05/16/06 4:01 AM >>> 
> > Somewhere in the process of filling the DataTable, the DateTime is 
> > converted back to a string because GetSchemaTable says the column is 
> > string-typed.   
>  
> GetSchemaTable is assumed to have the correct schema information and 
> this is used  to create the columns when dataset is filled.. 
> So, if GetSchemaTable has the datatype info as String for a column, 
> the column created in the dataset will also be of type 'string' .. 
> If you do not want the column to be converted to a 'String' then pls 
> make sure that GetSchemaTable contains the correct 'DataType' .. 

Thanks for the chapter and verse. I hope Joshua will add my fix to the live 
code (fame at last:-).

The next question to ask is why, after the data was converted to a string, 
converting it back to a DateTime with DateTime.Parse reversed the month and 
day. To try to find that out, I executed the following code...

DateTime d = new DateTime(2006, 05, 11, 12, 0, 0);
String s = d.ToString();
        
Console.WriteLine("DateTime starts as {0:yyyy-MM-dd HH:mm:ss}", d);
Console.WriteLine("ToString gives {0}", s);
d = DateTime.Parse(s);
Console.WriteLine("DateTime ends up as {0:yyyy-MM-dd HH:mm:ss}", d);

The output from this was...

DateTime starts as 2006-05-11 12:00:00
ToString gives 11/05/2006 12:00:00
DateTime ends up as 2006-11-05 12:00:00

This indicates that DateTime.Parse will not reverse the action of 
DateTime.ToString, which I consider to be another bug. Running the same 
program on Windows using Microsoft.NET gives the correct answer.

By the way,  If I want to be friendly, what do I call you - Senganal, or T? 
And what does the "T" stand for?

-- 
Nikki Locke, Trumphurst Ltd.      PC & Unix consultancy & programming
http://www.trumphurst.com/




More information about the Mono-list mailing list