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)

Recommended Answers

All 4 Replies

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)?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.