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:
None 
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

[22 Feb 2012 11:34] Bogdan Dumitrescu
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 ).
[10 Sep 2012 14:27] Roberto Ezequiel Garcia Ballesteros
This error occurs in DbLinq code that is out of our scope.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.