mysql连接错误“字典中不存在给定键" [英] error in mysql connection "The given key was not present in the dictionary"
本文介绍了mysql连接错误“字典中不存在给定键"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用"ADO.NET MySQL驱动程序(连接器/NET)"连接到mysql数据库时出现问题
I have problem while connecting to mysql database using "ADO.NET Driver for MySQL (Connector/NET)"
我遇到了此异常The given key was not present in the dictionary.
MySqlConnection con = new MySqlConnection("Server=localhost;Database=pgs_db;Uid=root;Pwd=;");
MySqlCommand com = new MySqlCommand();
com.CommandType = CommandType.StoredProcedure;
com.Connection = con;
com.CommandText = "getStudent";
con.Open();
MySqlDataReader dr =com.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
con.Close();
推荐答案
抱歉,我使用的是连接字符串
sorry i was using a worng connectionstring
这是对的:
"server=localhost; user id=user; password=password; database=mydatabase; pooling=false;"
thnx Oded
thnx Oded
这篇关于mysql连接错误“字典中不存在给定键"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文