| Bug #10345 | Invalid cast from 'System.String' to 'MySql.Data.Types.MySqlDateTime'. | ||
|---|---|---|---|
| Submitted: | 3 May 2005 18:19 | Modified: | 16 Jun 2005 8:58 |
| Reporter: | StuFF mc | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | Connector / NET | Severity: | S1 (Critical) |
| Version: | 1 0 4 | OS: | |
| Assigned to: | CPU Architecture: | Any | |
[16 May 2005 8:58]
Vasily Kishkin
Could you explane me what dataGridViewTextBoxColumn2 is ? Could you write example program and attach to "Files" ?
[16 Jun 2005 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[8 Oct 2005 22:13]
Erik Andersen
Hi, I think I'm having the same issue. I'm trying to read some data from a database (MySql 4.1) through MySql Connector 1.0.7. My code is:
using System;
using System.Data;
using MySql.Data.MySqlClient;
class MainClass
{
public static void Main(string[] args)
{
DataSet ds = MySqlHelper.ExecuteDataset(myConnectionString, mySelectQuery);
DataTable dt = ds.Tables[0];
foreach(DataRow dr in dt.Rows) {
foreach (DataColumn dc in dt.Columns){
Console.WriteLine("Type: " + dc.DataType + " Value: " + dr[dc]);
}
}
}
}
This example panics when run in MonoDevelop 0.7 if one of the dates in the database is of the form "0000-00-00". The interesting part of the stacktrace:
Unhandled Exception: MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime
in <0x00094> MySql.Data.Types.MySqlDateTime:GetDateTime ()
[...]
This bug is also documented here:
http://wiki.nhibernate.org/display/NH/MySQL
Thanks,
Erik Andersen
[27 Feb 2006 16:46]
Sarvesh Shrivastav
Any updates on this bug, I am also waiting for the feedback. If any resolution is available then do update this, Thanks.
[14 Mar 2006 15:21]
Crasan Iulian Codrut
Hey to everyone,
I found a way to avoid this thing by changing the type of the field. This is an example:
priv_datatable_linii.Columns(2).DataType = System.Type.GetType("System.String")
Best wishis,
Codrut Crasan

Description: I have a DataGridViewTextColumn having a date. I can see the data, and I can even update all my fields, except this one with the date. I get this error: Invalid cast from 'System.String' to 'MySql.Data.Types.MySqlDateTime'. I set the ValueType of the column fot "MySql.Data.Types.MySqlDateTime" but I still have the error. I would be glad if you can help me, since I'm not having any answer to my bug reports !! How to repeat: this.dataGridViewTextBoxColumn2.DataPropertyName = "ContractDate"; this.dataGridViewTextBoxColumn2.HeaderText = "Contract Date"; this.dataGridViewTextBoxColumn2.Name = "ContractDate"; this.dataGridViewTextBoxColumn2.ValueType = typeof(MySql.Data.Types.MySqlDateTime); this.grdServiceContract.Columns.Add(this.dataGridViewTextBoxColumn2); grdServiceContract.DataSource = ds