Viraj Dhamal
Viraj Dhamal

Reputation: 5325

How to add result of Sql query(via SQL to LINQ) to datagrid in WPF

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.

Upvotes: 1

Views: 246

Answers (1)

user1038031
user1038031

Reputation:

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" />

Upvotes: 1

Related Questions