Error Show: INSERT command denied to user 'root'@'202.5.56.75' for table 'life'我需要在我的业务数据库中插入数据,其中表生命周期可用。
下面的代码,我正在写,但不打算插入。已经添加了MySQL.dll。
using MySql.Data.MySqlClient;
string constring="datasource=xxx.xxx.xxx.xxx;port=3306;username=root;password=root";
string Query = "insert into business.life (Email_id,First_Name) values('" + this.textBox1.Text + "','" + this.textBox1.Text + "') ;";
MySqlConnection conDataBase = new MySqlConnection(constring);
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
MySqlDataReader myReader;
try
{
conDataBase.Open();
myReader = cmdDataBase.ExecuteReader();
MessageBox.Show("Saved");
while (myReader.Read())
{
}
}
catch (Exception ex) {
MessageBox.Show(ex.Message);
} 如果有人知道什么好的解决方案,请帮助我。我是编程方面的新手。
发布于 2015-01-29 04:09:25
这个错误不是来自有问题的代码,而是数据库权限。您需要为root用户授予插入权限。
https://stackoverflow.com/questions/28201405
复制相似问题