CReating A DataTable structure with MySql DateTime
Hi all,
I'm having no luck finding info so I thought someone here might know.
I am setting up a routine whereby I have to copy the results of a MySQL stored procedure into a DataTable so that I can add fields to the end of the result.
Normally I would convert the Msql DateTime to something that I could more easily manipulate; however, the existing code that I have specifically addresses the MySql DateTime type in too many ways to easily change.
So I thought I could do something like this:
Code:
myDataColumn = new DataColumn("ETD_DT");
myDataColumn.DataType = System.Type.GetType("System.DateTime");
returnDataTable.Columns.Add(myDataColumn);
And substitute "MySqlData.Types.MySqlDateTime" for "SystemDateTime", but it fails with "Column Requires a Valid DataType".
Any ideas?
Re: CReating A DataTable structure with MySql DateTime
I am not very familiar with MySQL in .Net but here is something I think may be worth looking at:
Code:
myDataColumn.DataType = System.Type.GetType("System.DateTime");
myDataColumn.DataType = MySqlData.Types.GetType("MySqlData.Types.MySqlDateTime");
I don't even know if it can be done or if that method even exists. If it does not, sorry for wasting your time.
Re: CReating A DataTable structure with MySql DateTime
Hello,
You may also want to try:
Code:
myDataColumn.DataType = typeof(MySql.Data.Types.MySqlDateTime);
Gary