Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Display Data In Form Based On Value in Another Form

$
0
0
I'd like to populate a DataGridView on one form based on the value in another form's DataGridView.

For example:
In one form, fLocations.dgv1, the user selects a row. This fires the dgv1_SelectionChanged event which gets me the CurrentCell.Value which is the 'location_id' equal to, say, 10.

In a different form, fRooms.dgv1, I'd like to run a query that displays rooms for location_id = 10.

Here's the query that populates fRooms.dgv1 (using SQL Server table names):
select *
from room_headers RH
join location_details LD on (RH.room_id = LD.room_id)
join location_headers LH on (LD.location_id = LH.location_id)
where LH.location_id = **the current location_id = 10**

I'm using Visual Studio C# Express 2008 and SQL Server Express 2008 R2. Any help is greatly appreciated, thanks.


Viewing all articles
Browse latest Browse all 2535

Trending Articles