| |

VerySource

 Forgot password?
 Register
Search
View: 883|Reply: 7

A question about dbgrid

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Unknown

Post time: 2020-1-18 14:00:01
| Show all posts |Read mode
When the program is running, I want to delete a record of dbgrid,
How to get the record that I selected with the mouse in dbgrid ?????????????

What if you want to delete multiple records? That is to say like this: I hold down a key such as the control key, and then use the mouse to select the record to delete. How do I implement it? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

I hope you can enlighten me! !!
For details, younger beginner, thank you! !! !! !!
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-24 08:09:01
| Show all posts
Using ActionList, write in OnExecute
Reply

Use magic Report

0

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-4-3 07:45:01
| Show all posts
Select dgMultiSelect in the Options property of DBGrid
Shift, Ctrl to select multiple records
Get selected records from SelectedRows

Write in CellClick event:
Clear all selected records with DBGrid1.SelectedRows.Clear statement; delete all selected records with DBGrid1.SelectedRows.Delete statement.
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-3 19:00:01
| Show all posts
Upstairs solution
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-4-12 21:00:02
| Show all posts
Select dgMultiSelect in the Options property of DBGrid
Hold down Shift, Ctrl to select multiple records
Get selected records from SelectedRows

Write in the CellClick event:
DBGrid1.SelectedRows.Clear statement can be used to clear all selected records; DBGrid1.SelectedRows.Delete statement can be used to delete all selected records


As such, is it necessary to set an attribute of that dbgrid to be editable, and then the records deleted in dbgrid are directly reflected on the database ???? There is no need to write the deleted SQL statement ????????
Reply

Use magic Report

0

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-7-12 13:30:01
| Show all posts
Yes, but this method is not good, I generally do not need data binding, DBGRID is only used for display.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-8-7 22:15:01
| Show all posts
I use dbgrid to display all records in a table, then I want to add a row at the end of dbgrid, and count the sum of a certain field in this table (for example, there is a number of fields in this table, then I want to add Add the number field in all records to get the total number) to form a record with "total" written in front, and then display the total number under the number of dbgrid column. How to??


Another problem is that when you use dbgrid to display records, it seems that you can directly set in the properties of dbgrid to display odd-numbered records in a certain color, and even-numbered records in a certain color. How to set it??? ????
Reply

Use magic Report

0

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-8-11 10:30:01
| Show all posts
Very simple, use the DBGRIDEH in the three-party control EHILB.
What you said above can be achieved.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list