MySqlDataReader reader = cmd1.ExecuteReader();报错

图片说明
GetConn是自己写了个数据库连接函数
图片说明

GetConn根本没有连上,检查下你的mysql服务器是否运行,3306端口是否打开,用户名密码和数据库名是否正确。
另外用户名应该是user id,而不是username
http://www.cnblogs.com/lsy131479/p/9212640.html