If you want to delete all records from a table with LLBLGen Pro v2.6 without first fetching all records, you can use the DataAccessAdapter DeleteEntitiesDirectly function.

            // Define the query that matches all records to be deleted.
// If no PredicateExpression are added all records will be deleted.
RelationPredicateBucket bucket = new RelationPredicateBucket(); // If you want to delete only the customers that have an Id != 100, uncomment the following line // bucket.PredicateExpression.Add(CustomerFields.Id != 100); // Initialize DataAccessAdapter using (DataAccessAdapter da = new DataAccessAdapter("server=MyServer; database=Test; Trusted_Connection=False;")) { // Delete the records from table CustomerEntity (TSQL query: delete Customer) da.DeleteEntitiesDirectly("CustomerEntity", bucket); }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.