You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue with MySqlConnector.MySqlDataAdapter belong here or some other project?
Steps to reproduce
// setup:
// create a MariaDB table named MyTable
// add a column of type "Date" named "MyDateColumn"
// add a row with a date value in MyDateColumn
using (MySqlCommand cmd = new("SELECT * FROM MyTable;", (MySqlConnection)connection))
{
using (MySqlConnector.MySqlDataAdapter adapter = new(cmd))
{
DataSet resultsDataSet = new();
adapter.Fill(resultsDataSet);
bool isCorrectType = resultsDataSet.Tables[0].Columns["MyDateColumn"].DataType == typeof(DateOnly);
}
}
The issue
isCorrectType == false.
The data in the database has MySql type Date, so the Fill() command should create a DataColumn of C# type DateOnly. Instead, it creates a DataColumn of C# type DateTime.
Further technical details
MySQL version: 11.2.2-MariaDB
Operating system: Windows 10 Pro 22H2
Pomelo.EntityFrameworkCore.MySql version: 8.0.0-beta.2
Microsoft.AspNetCore.App version: net8.0
The text was updated successfully, but these errors were encountered:
@Germs2004 Please report your issue on the MySqlConnector repo, which is the underlying ADO.NET library that Pomelo uses to access MySQL compatible databases. Thanks!
For backwards compatibility, MySqlDataReader, MySqlDataAdapter, etc. all return DATE columns as DateTime values, even though DateOnly would be a "better" CLR type. As noted in mysql-net/MySqlConnector#1231 (comment) this could be changed, but would need to be an opt-in behavior triggered by a connection string option. (There are currently no plans to implement this; as a workaround, C# clients can extract a DateOnly value from a DateTime value.)
Does this issue with MySqlConnector.MySqlDataAdapter belong here or some other project?
Steps to reproduce
The issue
isCorrectType == false.
The data in the database has MySql type Date, so the Fill() command should create a DataColumn of C# type DateOnly. Instead, it creates a DataColumn of C# type DateTime.
Further technical details
MySQL version: 11.2.2-MariaDB
Operating system: Windows 10 Pro 22H2
Pomelo.EntityFrameworkCore.MySql version: 8.0.0-beta.2
Microsoft.AspNetCore.App version: net8.0
The text was updated successfully, but these errors were encountered: