| Bug #64409 | MySql .Net Connector 6.5.1 and Linq to Sql with Date.Year doesn't work | ||
|---|---|---|---|
| Submitted: | 22 Feb 2012 11:34 | Modified: | 10 Sep 2012 14:27 |
| Reporter: | Bogdan Dumitrescu | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 6.5.1 | OS: | Windows (Windows 7 64 bit) |
| Assigned to: | Roberto Ezequiel Garcia Ballesteros | CPU Architecture: | Any |
| Tags: | Connector/Net, date, MySQL | ||
[10 Sep 2012 14:27]
Roberto Ezequiel Garcia Ballesteros
This error occurs in DbLinq code that is out of our scope.

Description: I'm using MySql .Net Connector 6.5.1 in my MVC 3 project. I'm also using Linq To Sql as my data access layer. I'm also using DbLinq to generate the c# code for the classes that map to the tables in the database. I have a problem with select queries that use DateTime.Year or DateTime.Month or DateTime.Day functions. The problem is if using a query like the one below, I get an error "Value cannot be null. Parameter name: method" var query = (from lawDoc in SuperlegeDc.LawDocuments select lawDoc.Date.Year).Distinct(); How to repeat: Create a .Net project. Create a .Net Linq to Sql connection to a MySql database. Use the .net connector 6.5.1 for MySql. Run a select query that uses DateTime properties from .net ( .Year, .Month, .Day ). Get an error from that query. Suggested fix: I think this is caused by the MySql .net connector and Linq to Sql, which does not properly translates code into a valid mySql query, when using DateTime Properties ( .Day, .Month, .Year ).