Skip to content

LINQ request

wone

Asked Mar 28, 2009, 6:33 PM EDT2 answers
Share
LinkedInX
Hi,

I have a table containing the columns CODE / DATE / PRICE / VOLUME. I want to make a request on a _listOfCode but I don't know what to put in the "where" query in the following lines. The length of the list could very from query to query. Please, can someone help me on this?

Thanks,
Kamel


using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace request_test
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        private List<string> _listOfCodes;
        private DATADataContext dataContext;

        public Window1()
        {
            InitializeComponent();
            dataContext = new DATADataContext();
            _listOfCodes = new List<string>();
            EditListOfCode();
        }

        private void EditListOfCode()
        {
            // We add the Codes for the query
            _listOfCodes.Add("POT");
            _listOfCodes.Add("SU");
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            // I want to make a query on the members of the lsit (POT and SU)
            Table<Data_IRESS> ListOfData = dataContext.Data_IRESSes;
            var listOfData = (from Lou in ListOfData

                              ///
                              //where (c =>  ))   What should I write?
                              //

                              select Lou);
        }
    }
}

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mahesh Chand
    0
    If you want all data, u don't put where clause at all. Keep it commented.
    0
  • 0
    Let'S say that in the table there are 5 codes:
    "AAPL"
    "MSFT"
    "SU"
    "POT"
    "RIM"

    I want to make a request on the _listOfSymbol. This time the list contains two symbols: "POT" and "SU".
    However the next time, in my list, I can find "MSFT" and "RIM" and "SU".

    How do I write this request?
    0