title: The SELECT permission was denied on the object 'Address', database 'CNET_85731', schema 'dbo'
body: <p>I have been working away for the last 7 months on a C# ASP.NET using Visual Studio 2008 and SQL Server 2008.</p>
  
  <p>Today, I was running part of my application which was previously running and I got the following error:</p>
  
  <p>The SELECT permission was denied on the object 'Address', database 'CNET_85731', schema 'dbo'.</p>
  
  <p>I walked through my code and discovered that this error was being caused in the following User Control:</p>
  
  <pre><code>protected void sdsAddressesList_Selected(object sender, SqlDataSourceStatusEventArgs e)
  {
      if (e.AffectedRows == 0)
      {
          ddlAddresses.Items.Insert((0), new ListItem("No Billing Addresses", "0"));
      }
  }
  </code></pre>
  
  <p>the SQLDataSource is defined as follows:</p>
  
  <pre><code>&lt;asp:SqlDataSource ID="sdsAddressesList" runat="server" OnSelecting="sdsAddressesList_Selecting" OnSelected="sdsAddressesList_Selected"
      SelectCommand="SELECT [AddressId], [ZipPostalCode], ZipPostalCode + '&amp;nbsp;--&amp;nbsp;' + Address1 AS CombinedAddress FROM [Address] WHERE ([CustomerID] = @CustomerID AND [IsBillingAddress] = @IsBillingAddress) ORDER BY [ZipPostalCode]"
      ConnectionString="&lt;%$ ConnectionStrings:eCoSysConnection %&gt;"&gt;
      &lt;SelectParameters&gt;
          &lt;asp:Parameter Name="CustomerID" Type="Int32" /&gt;
          &lt;asp:Parameter Name="IsBillingAddress" Type="Boolean" /&gt;
      &lt;/SelectParameters&gt;
  &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>Basically, what the control does is retrieve a list of addresses for the logged on user from the [Address] table and then populate the drop down list ddlAddresses.</p>
  
  <p>The Address table has all the same permissions as the rest of the tables in the database.  I have around 60 tables and approximately 200 stored procedures all merrily working away doing SELECTs, etc.  No problem.  Except for this one issue.  What on earth is going on?  I haven't made any changes to the database or table permissions.</p>
  
  <p>Can anyone help me please.</p>
  
  <p>Regards</p>
  
  <p>Walter</p>