How to delete all records in a BO?


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You can do this with SQL Server, DB2, etc.  Just call a truncate on a table.  Create a method on the BO that is called "DeleteAll" or something along those lines, then TRUNCATE the table.  This is akin to the VFP "ZAP" except far more efficient.

TRUNCATE TABLE MyTable

Note: This will delete ALL records within the table.  That is the same thing a ZAP used to do.  If you want to delete within a certain crtiera, then just create a command or a sproc (as Keith mentioned) to delete within that group or records.

Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
I had to do this and with many records in the BO it was slow (ZAP was awesome!!) so I did the delete via a stored procedure on the server (if your using SQL/DB2/Oracle/etc).

MicroFour.StrataFrame.Data.DataBasics.DataSources("").ExecuteStoredProcedure("rentitems_deleteitemsfororder", MicroFour.StrataFrame.Data.DbCommandExecutionType.ExecuteNonQuery, New SqlClient.SqlParameter("@ordnum", Me.BO_Orders.ordernum))



Keith Chisarik
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi,

I have a a BO with related records and at some point I would like to delete all records in the BO pretty much like a VFP DELETE ALL or ZAP, how to do this?

I have tried using the BO's GetEnumerable() I saw in thread like this:

For Each bo As IBS_BOL.PaymentScheduleBO In Me.PaymentScheduleBO1.GetEnumerable()

     bo.DeleteCurrentRow(True)

Next

Me.PaymentScheduleBO1.Save()

But the above code is not deleting all rows in the BO, so I must be missing something here.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search