字典中不存在给定的键。
描述:在执行当前web请求。请查看堆栈跟踪以了解更多信息有关错误的信息以及错误在代码中的来源。
异常详细信息:System.Collections.Generic.KeyNotFoundException:字典中不存在给定的关键字。
MySqlConnection con = new MySqlConnection("Data Source=localhost; Database=gransells; User ID=root; Password=PASSWORD;");
MySqlCommand cmd = new MySqlCommand("select description from product where productId=1", con);
MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapter.Fill(ds);
您在表中有主键,您正在设置但未检索。。在select语句中使用该主键。