# .NET and More > WPF, WCF, WF >  WPF Binding Query to GridView

## HongKongCV

Okay, I'm learning WPF and am working on my first program that actually pulls data from the database.  I have a listview (gridview), and I have a query that I want to use to fill that control.  The query joins two tables together to get the data I want.... it returns six columns from two tables.

How do I bind the the results of that query so that the data shows up in the gridview?

Dead easy in windows forms, but can't figure it out in WPF...

----------


## ForumAccount

Use the WPF forum here. There are, however, a ton of articles on data-binding in WPF.

----------


## jmcilhinney

This was the first result in a search for _wpf bind listview_:

http://www.c-sharpcorner.com/uploadf...tabinding.aspx

Took me about 10 seconds to find it.

----------


## si_the_geek

_Thread moved from the 'VB.Net' forum to the 'WPF, WCF, WF' forum_  (thanks for letting us know jmcilhinney  :Thumb:  )

----------


## HongKongCV

Yes, jmcilhinney, I found that, too.  But my query joins two tables... is the syntax on the code side still the same?  I mean, do I still:

ListViewEmployeeDetails.DataContext = ds.Tables[0].DefaultView;

----------


## jmcilhinney

> Yes, jmcilhinney, I found that, too.  But my query joins two tables... is the syntax on the code side still the same?  I mean, do I still:
> 
> ListViewEmployeeDetails.DataContext = ds.Tables[0].DefaultView;


Did it work when you tried it?  Wouldn't that answer your question?

A DataTable is a DataTable.  Where the data comes from is irrelevant once it's in the DataTable.

----------


## HongKongCV

Okay, I got it working... I have a related problem, but I'll post that in another thread.

----------

