| |

VerySource

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

How to display the data

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-11 10:00:01
| Show all posts |Read mode
I have displayed the data from SQL Server in the DBGrid. Now I want the user to select a row of records and display them in the corresponding control. What should I do?
For example: a table in the database has three fields: name (char), password (char), purview (char). I have a datasource in my program.
Now that the data is displayed in the DBGrid, the corresponding fields of the record selected in the DBGrid (with three fields) need to be displayed in the three controls edit1, edit2, and edit3 respectively.
Reply

Use magic Report

0

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Unknown

Post time: 2020-4-6 22:45:01
| Show all posts
In OnMouseDown or OnKeyDown
Take out SelectedRows
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-15 09:30:02
| Show all posts
This is very simple. In the click event of this DBGrid, the content of the corresponding field in the current record of the dataset corresponding to this DBGrid is assigned to the text of the edit control.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-21 18:00:02
| Show all posts
Set up three other DBEdit controls and use the same DataSource as DBGrid.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-22 23:00:01
| Show all posts
To add to the above statement, the three DBEdit datafields write the domain names of the three domains
Reply

Use magic Report

0

Threads

15

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-5-27 18:30:02
| Show all posts
Do n’t use edit1, edit2, edit3,
You use DBEdit1, DBEdit2, DBEdit3, instead of the above
Choose DATASource as the same data source as DBGrid!
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-23 17:15:02
| Show all posts
I add myself: remember to add DBEdit Connection, ;-P
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-7-13 10:45:01
| Show all posts
Drag three DBEdit controls on the form, the DataSource and DBGrid settings are the same, and then select the Field you want to display the DataField, it's ok.
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