select command denied to user '<userid>'@'<ip-address>' for table '<table-name>'
可能出了什么问题?以下是我遇到错误的代码段。我尝试调试并发现它在这一行失败:
MySqlDataReader result1 = command1.ExecuteReader();
下面是我的代码: String addSQL = "Select Max(`TradeID`) from `jsontest`.`tbl_Positions";
MySqlConnection objMyCon = new MySqlConnection(strProvider);
objMyCon.Open();
MySqlCommand command = objMyCon.CreateCommand();
command.CommandText = addSQL;
MySqlDataReader result = command.ExecuteReader();
//int j = command.ExecuteNonQuery();
while (result.Read())
{
MaxTradeID = Convert.ToInt32(result[0]);
}
objMyCon.Close();
for (i = 1; i <= MaxTradeID; i++)
{
String newSQL = "Select `Strike`,`LongShort`,`Current`,`TPLevel`,`SLLevel` from `json`.`tbl_Position` where `TradeID` = '" + i + "'";
MySqlConnection objMyCon1 = new MySqlConnection(strProvider);
objMyCon1.Open();
MySqlCommand command1 = objMyCon1.CreateCommand();
command1.CommandText = newSQL;
MySqlDataReader result1 = command1.ExecuteReader();
objMyCon2.Close();
dbo.
无法正常工作:当dbo.tablename
被更改为tablename
时,代码可以正确执行。 - Doug_Ivisonselect * from dbo.table
可以运行,但今天只有去掉dbo
前缀才能运行select * from table
,如果加上dbo
前缀则会出现访问拒绝的错误。 - SüniÚr