Do you know why it is slow, Because of the number of database calls, more number of checked item more number of database call.
Things you can do to avoid that
1) Create a stored procedure in your database which accepts list of items to be removed (
How To Pass Array Or List To Stored Procedure[
^])
2) Call the stored procedure using command (since you want to use the command)
3) Within a single DB call you will be able to delete N numbers of records.
for your comment that you are new to coding, These kind of problem should motivate you to write good code and it involves learning which will help you to enhance your coding skills.
Call to stored procedure
using (SqlConnection conn = new SqlConnection("yourconnectionstring")) {
conn.Open();
SqlCommand cmd = new SqlCommand("yourprocedure", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("yourparameter", list));
cmd.ExecuteNonQuery();
}
Happy learning.