F
F
FAwafawf12122021-05-31 06:21:36
WPF
FAwafawf1212, 2021-05-31 06:21:36

How to display data from two related tables in datagrid for editing?

There are 2 tables created by a key. There is a page (page), it has a datagrid, how to display a table in it, which will include data from two tables at once, so that you can edit them, delete and add.
I display the data in the datagrid in this way

<DataGrid x:Name="DgridClava" AutoGenerateColumns="False" IsReadOnly="True" Margin="0,0,-438,0" RenderTransformOrigin="0.5,0.436">
  <DataGrid.Columns>
                            <DataGridTextColumn Header="Модель клавиаутры" Binding="{Binding ModelClaviatura}" Width="*"></DataGridTextColumn>
                            <DataGridTextColumn Header="Инвентарный номер" Binding="{Binding InventarNomerClaviatura}" Width="*"></DataGridTextColumn>
                            <DataGridTextColumn Header="Серийный номер" Binding="{Binding IdClaviaturaReal}" Width="*"></DataGridTextColumn>
 </DataGrid.Columns>
     </DataGrid>

But it only works when I have 1 unrelated table, and for two related I can't find anything better.
I tried to make SQL Queries in the database itself, I found one that suits me, it displays all the data in the form in which I want to see them in the Datagrid and therefore the question is, how can I display the result of an SQL query in the datagrid? so that you can then edit, delete and add data, links to information on the topic where there will be no water, examples, so that you can understand, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2021-05-31
@tsklab

No, linked tables are read-only information. Output information for editing separately.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question