Getting DateTime error from C# OleDbADbAdapter with MySQL
Posted by: comic rage
Date: October 10, 2006 11:00AM

Hi,

I am connecting to MySQL 5.0 and using OleDbConnection to connect and OleDbAdapter to read in tables to my DataTable. Here is my code



m_DbConnection = new OleDbConnection("Provider=MySQLProv;Data Source=mydb;User Id = test; Password=test;");
m_DbConnection.OPen();
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Categories", m_DbConnection);
DataTable Table = new DataTable("categories");
da.Fill(Table);


when it hits, da.Fill call, I get the following error message

Parameter name: Year, Month, and Day parameters describe an unrepresentable DateTime

I looked in my MySQL, the DateTime field is 2006-10-10
When I check for the C# DateTime format in this code

DateTime t = DateTime.Now;

the C# format is 10/10/2006


What can I do to fix this? When I filled the datatable, how can I reformat the DateTime field to fix this issue?

Thanks

Options: ReplyQuote


Subject
Written By
Posted
Getting DateTime error from C# OleDbADbAdapter with MySQL
October 10, 2006 11:00AM


Sorry, you can't reply to this topic. It has been closed.

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.