1

Hi i want to add the result of sql query to datagrid in my WPF application. I use SQL to LINQ to fetch data.Please help me.

1 Answer 1

1

Just Set the ItemSource property of the DataGrid to the value of the result of that query using C# :

dataGrid1.ItemSource = query ;

ensure you set the AutoGenerateColumns property into true in XAML

<DataGrid x:Name="dataGrid1" 
    AutoGenerateColumns="True" />
Sign up to request clarification or add additional context in comments.

1 Comment

what to do in case when i use grid control , <Grid Height="341" Name="grid1" Width="833" > </Grid>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.