<add key= "Connstringmysql" value= "SERVER=XXX.XXX.XXX.XXX;DATABASE=YOURDATABASE;UID=XXX;PWD=XXX;POOLING=FALSE; Charset=utf8; Treat Tiny as Boolean=false; Convert Zero datetime=false "/>
1.pooling: The value of this key is set to true and any newly created connection will be added to the connection pool when the program is closed, the connection is taken from the connection pool the next time you try to open the same connection, and if the connection string is the same, it is considered the same connection. If the connection string is not the same, it is considered a different connection.
2.charset: This one should understand that setting character encoding
3.Treat Tiny as Boolean: If set to true, the tinyint type in MySQL will be converted to the bit type in MS Server, but sometimes we do not want this to be converted, so this can be configured according to their own needs
4.Convert Zero Datetime: This problem is encountered today, and when this property is not set, if the Datetime column in the MySQL database is null,. NET throws the following exception when converting: unable to convert MySQL Date/time value to System.DateTime at MySql.Data.Types.MySqlDateTime.GetDateTime () This is because the default minimum date for. NET and MySQL mismatch, resulting in a conversion error, the solution is the above connection string (set convert Zero datetime=true)
protected static string connectionString = "server=127.0.0.1; User Id=root; Password=root; Persist Security info=true;database=lianxi0727; Allow Zero datetime=false; ";
Allow Zero datetime=true should be false, otherwise the returned date will be MySql.Data.Types.MySqlDateTime type, not datatime
Database 2018-02-01 00:00:00 If true, the conversion fails
MySQL link string problem