Good day All,
I'm new here I just started programming in C# not to long ago.
I'm building a little project connected to an SQL database and I'm not able to get the Result that I want I always get the length in the DataGrid.
I have a ComboBox with a listing. When selecting from the drop-down I take the Value and get the Partner_tb.PartnerKey from it. then I try to get a listing from the Document_tb based on the PartnerKey.
I always get 1 column with the length if I show the partnerKey.toString(). but the value should look like "MarcCyn"
Here's the code I have :
- public void partnerBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- var partnerKey = from pn in dataContext.Partner_tbs
- where pn.PartnerName == PartnerBox.SelectedValue.ToString()
- select pn.PartnerKEY;
- var documentName = from Document_tb in dataContext.Document_tbs
- join Partner_tb in dataContext.Partner_tbs
- on Document_tb.PartnerKEY equals Partner_tb.PartnerKEY
- where Partner_tb.PartnerKEY == partnerKey.ToString()
- select new { Document_tb.PartnerKEY, Document_tb.DocumentName, Document_tb.TransactionSetID, Document_tb.ControlNumber } ;
- list997.ItemsSource = documentName;
- }
I would really appreciate any help on this.
Thanks in advance.
Marc