This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello! How can I delete more than one row from table using LightSpeed without fetching them from table? I've found one example in in UserGuide:
But this works only with one row. In samples I've found delete sample but it deletes only one row too:
Maybe only solution for this is retrieve all rows which I want to delete and remove them from DB in FOR loop? Thanks |
|
|
Hi Webio, The Remove() method will delete any rows matching that query. For example, you could try deleting all rows by calling with a query such as Entity.Attribute("OrderID") != -1 which would match on everything (assuming the had to have an OrderID). Hopefully that helps clarify how you would do this. Hope that helps, John-Daniel |
|
|
Thanks for answering but I have one more question: in example which I showed there is:
I'm talking right now about index "[0]". Should it be used when removing more than one row? For example:
Thanks |
|
|
Hi Webio, Calling UnitOfWork.Remove(orderByCategory[0]); will delete whatever entity is sitting at that index in the collection. Be careful when doing this as if you ever change the order of items in your collection or if there is nothing in the collection you'll get an error. I hope that makes sense and helps, John-Danie |
|