Filling three datagridviews from the same bindingsource.
Date: 03/14/06
(C Sharp) Keywords: no keywords
Now that those last problems are gone, onto the interesting stuff. And yes, I do know there's a much easier way to do this; my problem, anal chap that I am, is that the bottom of the screen is already way, way too cluttered with bindingsources and tableadapters, and I'd prefer to keep this all in one big shot.
I have a form containing, among other things, three tabs. On each tab is a datagridview. All three datagridfiews are databound to the tongue-twistingly-named fkHospitalsRateDataBindingSource, whence stems the rateDataTableAdapter.
Background, if necessary: there's an FK relationship between Hospitals (the parent) and RateData (the child). What I want to occur: when the hospital is changed on the top half of the form, the rate data updates in the bottom half. THAT part of it is working.
You may be asking why I have three datagridviews. And there is the heart of my conundrum.
The RateData table contains three types of data, specified by the RateTypeIDs of 1, 2, and 3 (RateTypeID is a column in the RateData table). My goal is, both on form load and SelectedPositionChanged for the combobox with the hospital names, to update all three of these datagridviews with, basically, the same query:
SELECT ID, ProvID, Category, DRGs, RevCode, TypeID, Rate, Comment, LineEffective, LineExpiration, RateTypeID FROM dbo.RateData WHERE RateTypeID =
...and it's finished with a number from 1 to 3, depending on the datagridview.
The easiest way I can see to do this is to change the query in the bindingsource to which the datagridview binds. But I cannot for the life of me figure out how to do that. Is it possible to specify a query other than the default in the datagridview's datasource? Thanks.
Source: http://community.livejournal.com/csharp/52430.html