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
The same testcase,
MySqlConnector is failed, MySql.Data works!
[TestMethod]publicvoidTest_DateTime_DataType(){stringconnectionString1="Server=FishDbServer;Database=MyNorthwind;Uid=user1;Pwd=qaz1@wsx";stringconnectionString2="Server=FishDbServer;Database=MyNorthwind;Uid=user1;Pwd=qaz1@wsx;Allow Zero Datetime=True;Convert Zero Datetime=True;";objectresult1,result2;using(MySqlConnectionconn1=newMySqlConnection(connectionString1)){conn1.Open();MySqlCommandcommand1=conn1.CreateCommand();command1.CommandText="select now()";result1=command1.ExecuteScalar();}using(MySqlConnectionconn2=newMySqlConnection(connectionString2)){conn2.Open();MySqlCommandcommand2=conn2.CreateCommand();command2.CommandText="select now()";result2=command2.ExecuteScalar();}Assert.AreEqual(typeof(DateTime),result1.GetType());// set "Allow Zero Datetime=True", result is MySqlDateTimeAssert.AreEqual(typeof(MySql.Data.Types.MySqlDateTime),result2.GetType());DateTimetime1=(DateTime)Convert.ChangeType(result1,typeof(DateTime));// MySqlConnector throw error: System.InvalidCastException: Object must implement IConvertible.// MySql.Data, It works!DateTimetime2=(DateTime)Convert.ChangeType(result2,typeof(DateTime));// MySqlConnector// public struct MySqlDateTime : IComparable// MySql.Data// public struct MySqlDateTime : IMySqlValue, IComparable, IConvertibleAssert.AreEqual(time1,time2);}
The text was updated successfully, but these errors were encountered:
The same testcase,
MySqlConnector is failed, MySql.Data works!
The text was updated successfully, but these errors were encountered: