开发者

error in mysql connection "The given key was not present in the dictionary"

I have problem while connecting to mysql database using "ADO.NET Driver for MySQL (Connector/NET)"

I got this exception The given key was not present in the dictionary.

Edit:

MySqlConnection con = new MySqlConnection("Server=localhost;Database=pgs_db;Uid=root;Pwd=;"); 
MySqlCommand com = new MySqlCommand(); 
com.CommandType = CommandT开发者_如何学Cype.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

this is a right one :

"server=localhost; user id=user; password=password; database=mydatabase; pooling=false;"

thnx Oded


Without seeing the code, I am guessing you are trying to access a configuration key that does not exist in your application config file.

Edit: After seeing the code sample, the problem is probably not with connecting to the DB.

I would say that in your GridView, you are binding to a field that is not returned by the DB query.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜