hi, can u help me

my Datagrid which connected to ADODC1 was updating evrytime i click my ADD command button, then i made another command button to CLEAR what data is in the grid, i used this codes to do that but always error like this "KEY COLUMN INFO IS INSUFFIECIENT OR INCORRECT. TOO MANY ROWS WERE AFFECTED BY UPDATE"

Adodc1.Refresh
While Not Adodc1.Recordset.EOF
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Wend

i want when i click clear button, all the data in grid will erase and also in the database.

help me please :)

Recommended Answers

In your grid its quite simple...

DataGrid1.Clear

Getting to your deleting of all records, are you sure that is what you want to do. Why set up a table, add data to it just to delete it all again? Why not just delete the records you …

Jump to Post

All 2 Replies

In your grid its quite simple...

DataGrid1.Clear

Getting to your deleting of all records, are you sure that is what you want to do. Why set up a table, add data to it just to delete it all again? Why not just delete the records you don't want anymore....

I hope this will help you
Set Datagrid1.DataSource = Nothing
It will clear the Datagrid .

Regards,
Shahid From Pakistan
+92-0333-4186355

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.