title: Error: select command denied to user '<userid>'@'<ip-address>' for table '<table-name>'
body: <p>In my website, I am using MySQL database. I am using a webservice where in I do all my database related manipulations.</p>
  <p>Now In one of the methods of that webservice, I get the following Error.</p>
  <blockquote>
  <p>select command denied to user '&lt;userid&gt;'@'&lt;ip-address&gt;' for table '&lt;table-name&gt;'</p>
  </blockquote>
  <p>What could be wrong?</p>
  <p>Below is the code where I get that error. I tried debugging and found that it fails at the line</p>
  <p><code>MySqlDataReader result1 = command1.ExecuteReader();</code></p>
  <p>Here is my code:</p>
  <pre><code>        String addSQL = &quot;Select Max(`TradeID`) from `jsontest`.`tbl_Positions&quot;;
          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 &lt;= MaxTradeID; i++)
          {
              String newSQL = &quot;Select `Strike`,`LongShort`,`Current`,`TPLevel`,`SLLevel` from `json`.`tbl_Position` where `TradeID` = '&quot; + i + &quot;'&quot;;
              MySqlConnection objMyCon1 = new MySqlConnection(strProvider);
              objMyCon1.Open();
              MySqlCommand command1 = objMyCon1.CreateCommand();
  
              command1.CommandText = newSQL;
              MySqlDataReader result1 = command1.ExecuteReader();
             objMyCon2.Close();
  </code></pre>