DataAdapter Inserts

rpiller

Member
Joined
Feb 6, 2007
Messages
8
Programming Experience
5-10
I'm wondering if this is possible? I'm trying to make a front end grid that makes it easier for users to insert/update some data. There are 2 levels in this data. let's say for example I have a state field and a city field.

State | City | HighValue | LowValue
----------------------------------------
WI |Madison | 0 | 1
WI |Madison | 2 | 4
WI |Madison | 5 | 6
WI |Green Bay | 0 | 1
WI |Green Bay | 2 | 4
WI |Green Bay | 5 | 6

As you can see the data is the exact same for Madison and Green Bay, and they are BOTH part of the WI state. This is how the data will always be. The data for every city grouped by the state I always want to be the same.

Since this is the case, to make it easier for the user to enter data I just want to show them a grid of the values BY state NOT by city. But when I update/insert the database I want to blow it out by city.

So for example what I have are radio buttons of each state. When they select a radio button of a state it runs a query against the above table and does:

Select HighValue, LowValue
From table
Where State = 'WI'
Group By HighValue, LowValue;

So let's say the user selects WI, the only data that will show in the gridview is:

0 | 1
2 | 4
5 | 6

Now say the insert a new record into the gridview of 7 | 8. When I actually insert I want to do so for every city that has WI as the state.

IS there a way to do this using the dataadapter? It basically has to create more records than what was inserted into the gridview. In the above example the user may have only added 1 record, but I desire 2 records to be created. 1 for Green Bay and 1 for Madison.

Hope that makes sense.
 
You seem to be talking about related data Where one state can have many cities and one city can have many Hi Lo values

Read the DW2 link in my signature, first read the section Creating a Simple Data APp
Then read Displaying /Saving Related Data
 

Latest posts

Back
Top