Question

I have a binding source that is connected to a database. The binding source is connected to a data table that has 4 columns. Terms, Definitions, Store ID, and ID. I currently have a filter on Store ID so i can grab all the terms and definitions for the current store. Using this binding source i want to put terms in a List and the definitions in a list but I am not sure how to do this. I saw that in the currency manager there is a List method. What is the best way to do this?

THE FILTER IS ON THE DEFINITION BINDING SOURCE

I tried using table adapters but it is no filtering the store and here is the code i have tried:

        var definitionDataTable = definitionTableAdapter.GetData();
        var termArray = (from row in definitionDataTable.AsEnumerable()
                         select row.Field<string>("Term")).ToArray();
        var definitionArray = (from row in definitionDataTable.AsEnumerable()
                               select row.Field<string>("Description")).ToArray();

Any help is much appreciated, i am new to using databases just FYI.

Was it helpful?

Solution

try :

var termArray = (from row in definitionDataTable.AsEnumerable() 
where row.Field<int>("StoreID")==yourID select row.Field<string>("Term")).ToArray();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top