views:

201

answers:

2

I am using a MySQL database with DbLinq, but there is an exception being thrown:

"Cannot convert mysql datetime to system.datetime"

How can I resolve this issue?

A: 

Well, if you have a result set containing MySql DateTime values, you could use the ConvertAll method along with a delegate using DateTime.Parse to create a collection of System.DateTime values.

Here's an example, where "results" is the result of your dblinq query containing MySQL datetime values:

List<DateTime> dateTimes = results.ConvertAll(delegate(string time){ 
   return DateTime.Parse(time); 
});

Is this what you're looking for?

Donut