cancel
Showing results for 
Search instead for 
Did you mean: 

how to clear data from datawindow?

Former Member
0 Kudos

suppose I have a datawindow.

I need to do following for data on this datawindow:

retrieve data from database:     //use datawindow.Retrieve()

delete all data retrieved           // How to do this? need to delete all rows from data by loop and then call Datawindow.Update()??? any simple way?

Insert new data to datawindow and save it  //use datawindow.insertRow and then call DataWindow.Update()

what's the simple way to do this job?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can use RowsMove Method. For example:

dw_1.RowsMove(1, dw_1.RowCount(), Primary!, dw_1,1, Delete!)

That will move the rows from the primary buffer to delete buffer and the rows are marked for deletion.

When you call dw_1.Update(), the rows in the Delete! buffer will be deleted.

Then you call dw_1.Reset() to clear the datawindow control.

Check on the RowsMove datawindow method for more details.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kent;

  You might like to try DC's Reset ( ) method for that.

HTH

Regards .. Chris

Former Member
0 Kudos

Thanks. I have tried Reset, looks like it only clean data in datawindow, not in database.

Former Member
0 Kudos

Hi Kent;

  For that, you could

1) Loop thru the DWO's buffer using the DC's DeleteRow ( ) method. Then use the Update ( ) method.

    - or -

2) You could just use an in-line DELETE SQL command (this would be more efficient IMHO than #1).

Regards ... Chris