private void displayWith1Criteria(string column, string value)
        {
            Console.WriteLine("entering _1_ display method");
            dbcontent = new DBtestEntities();
            var studienummerQuery = from members in dbcontent.Medlemmer.Include("Retninger")
                                    where column == value
                                    orderby members.Fornavn
                                    select new { Studienr = members.Studienummer, Fornavn = members.Fornavn, Efternavn = members.Efternavn, Email = members.Email, Studiested = members.Studiested, Betaling = members.BetalingsType, Uddannelses_Retning = members.Retninger.retningNavn };

            dataGridView1.DataSource = studienummerQuery;
        }

Doesnt return any data at all...

column is being called with members.Fornavn (Fornavn = a column name)
value = Anders (one of the data's in Fornavn column)

Without knowing what column, value and dbcontent contains there is no way to answer your question. Also, what's the point of passing in two parameters that you only use to compare to each other (line 6)?

Edited 6 Years Ago by Momerath: n/a

Well coloumn and value i have given examples off.
And dbcontent is an entity "class".. of a database i have made.

What content is in the variables? Did you pass the same string for column and value? Is there anything loaded into dbcontent, and if so, what?

My database is loaded into dbcontent using a .edmx file from ABO entity class.
My database consist of 2 tables, "Retninger" and "Medlemmer".
Medlemmer contains columns things like Fornavn(in english, Firstname), Efternavn(Lastname), Studienummer(study no.)
What i would like is a "dynamic" method that can set both which column to be searched in and the value that needs to be searched for in the set column.

This article has been dead for over six months. Start a new discussion instead.