C# Input string was not in correct format for MySQL DateTime -
i looking through various pieces of information this, , couldn't find after hour of searching, i've been forced ask specifically.
in mysql database, have series of tables created_dt column, datetime(6) field. example of data be: 2015-06-19 11:52:07.000000
i can pull column table in database except one, reason. whenever make connection string, , fill datatable adapter, error in title. code:
mysqlcommand cmd = new mysqlcommand("select created_dt comptran_bulk", connection); mysqldataadapter da = new mysqldataadapter(cmd mysqlcommand); datatable dt = new datatable(); da.fill(dt); // exception thrown, when data loaded table.
this command replaced "select * view_sales"
, , solutions cast differently don't think work. also, none of values created_dt
null, allow 0 datetime=true
didn't work.
what suggest?
the answer going in old error ticket in 2012.
"[1 jun 2012 13:39] dan berger not seem fixed in 6.4.5 - still formatexception.
i can narrow problem down more if helps:
mysqldatetime success = new mysqldatetime("2012-01-01 12:00:00");
mysqldatetime failure = new mysqldatetime("2012-01-01 12:00:00.123456"); // throws formatexception
my server "mysql 5.1.41-3ubuntu12.10", if makes difference."
when using in c# .net, microseconds cause of error. after modifying things become datetime(0) instead of datetime(6), things have started work.
Comments
Post a Comment