I had a problem with Kennedys site today. Being the 10th where I have the site hosted the sort of the entrys put the entry for today below several that were earlier in the month like on th 8th…

Well the problem was in the code. As I say in class the problem was with something that I typed in. It usually is the input and rarely the application that is to blame as some students like to think.

With sorting strings 6/10 is before 6/8. Just look at it.. 6′s are eqaul. /’s are equal. 1 is earlier than 8. Done. Problem found.

Well really the problem was that I was sorting strings. I was using a datatable. The reason for this is that I was building a custom table by files and database entries. The dates of the files and the DB entries needed to line up. So I sorted them The problem was when I set up the datatable. I didnt specify the column datatype which is optional.

Now I have. The other problem was is that is wants a type. Well sure for this column I wanted system.datetime. But that wouldnt fit. It cannot be used as an expression. So .NET leaves me with a gettype construct to which I pass a string of the type. I assume it uses some reflection to find the type. I tried to used system.datetime.getype and typeof(system.datetime) etc.

Here is what worked:

DT.Columns.Add(“filedate”, Type.GetType(“System.DateTime”))