Having trouble displaying MonthName in a DataGridView from data in MySQL
Query:
SELECT ItemName, Description, PurchaseDate, MONTHNAME(PurchaseDate) AS PurchaseMonth FROM tblItems
Error:
System.ArguementException:Parameter is not valid
Displaying the month number, using MONTH(PurchaseDate) works perfect but when I try to show the month name I get a datagrid error. When I run the SQL in MySQL it returns the expected results.
When I add in a DataError event it just shows a red exclimation mark in the fields where MONTHNAME(PurchaseDate) should be.
Solved it.
Even though MonthName(PurchaseDate) worked when run directly against the database, I had to use Cast in the SQL string when passing in from VB.NET
Amended SQL: