title: delete from gridview using stored procedure
body: <p>Hi i have a gridview, linked to a sqldatasource. I have added a stored procedure to delete from multiple tables, and then enabled deleting on the gridviews smart tag.</p>
  
  <p>When i click the delete button i get an error message, "Object must implement IConvertible". I read that it is a problem passing the parameter to the stored procedure, possibly the wrong datatype being passed. Im not sure if i am passing the parameter to the stored procedure at all. The parameter should be the gridviews datakeyname, in this case it is "UserId". </p>
  
  <p>The stored procedure works i fine in management studio, so i think it is just the parameter being passed (or possibly not being passed)</p>
  
  <p>Do i have to code the parameter in the code behind to be passed to the stored procedure?</p>
  
  <pre><code>&lt;asp:SqlDataSource ID="selectUsers" runat="server" ConnectionString="&lt;%$ ConnectionStrings:CASSFConnectionString %&gt;"
          SelectCommand="SELECT aspnet_Membership.UserId, aspnet_Membership.IsLockedOut, aspnet_Membership.Email, aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.LastPasswordChangedDate, aspnet_Profile.PropertyValuesString, aspnet_Users.UserName, aspnet_Membership.IsApproved FROM aspnet_Membership INNER JOIN aspnet_Profile ON aspnet_Membership.UserId = aspnet_Profile.UserId INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId AND aspnet_Profile.UserId = aspnet_Users.UserId WHERE (CONVERT (nvarchar(256), aspnet_Profile.PropertyValuesString) = @district)" 
          DeleteCommand="DeleteUsers" DeleteCommandType="StoredProcedure" UpdateCommand="UPDATE [aspnet_Membership] SET [IsApproved] = @IsApproved, [Email] = @email, [IsLockedOut] = @IsLockedOut WHERE [aspnet_Membership].[UserId] = @UserID"&gt;
          &lt;SelectParameters&gt;
              &lt;asp:ControlParameter ControlID="DropDownList1" Name="district" PropertyName="SelectedValue" /&gt;
          &lt;/SelectParameters&gt;
          &lt;DeleteParameters&gt;
              &lt;asp:Parameter Name="UserId" Type="String" /&gt;
          &lt;/DeleteParameters&gt;
          &lt;UpdateParameters&gt;
              &lt;asp:Parameter Name="IsApproved" /&gt;
              &lt;asp:Parameter Name="email" /&gt;
              &lt;asp:Parameter Name="IsLockedOut" /&gt;
              &lt;asp:Parameter Name="UserID" /&gt;
          &lt;/UpdateParameters&gt;
      &lt;/asp:SqlDataSource&gt;
  </code></pre>