Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF DataGridCombobox w SQL Server Database Example

$
0
0

Hey Everybody,

I've been researching this for over a month and I can't find an actual working example.

What I'm looking for is a working example of a WPF Datagrid with a combobox that uses one table from a SQL Server database to populate the dropdown list for the combobox, and another for the datagrid.

For example:

I have two tables( Accident, Injuries).

The accident table contains the following columns(and sample data):

AccidentID, Name, InjuryID, AccidentDate

1                Bob          3        01/01/2013

2                John         2        03/20/2013

The Injuries table has the following columns(and sample data):

InjuryID, InjDescription

1             Fracture

2             Concussion

3             Sprain 

What I would like is for the datagrid(lets call it "AccidentsDataGrid") to display as follows:

AccidentID,    Name,    InjuryID,        AccidentDate

1                   Bob        Sprain            01/01/2013

2                   John       Concussion     03/20/2013

The InjuryID column is home to the combobox which should show the Injuries table rows to select the type of injury.

The AccidentDataGrid should be able to Insert and Update the Accident table via a button, or on change to the AccidentsDataGrid.

Can anyone point me to a working example, or if anyone is feeling really adventurous and/or generous and wants to code this out for me, that would be great! I'm even willing to pay for the working xaml and code behind code(sorry, a couple hundred (US) is all I can afford).

Please Help. I'm desperate!!! I've literally scoured the web for a solution to no avail...

Every example does a small piece in a different language, or using some other data source that doesn't work for what I need.

This seems to be an extremely sought after example, that no one seems to have coded.

 


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>