MVC 2 C # LINQ to SQL búsqueda con categoría

I have a drop down list that is used to filter data from a table. The drop down list has two items: with xx and without xx.

How do I construct a L2S query to filter a table?

An example SQL call is SELECT * FROM ProductionTasks WHERE Designation like '% xx %'

There is a controller named TaskDatabaseController.cs and the database with the ProductionTasks table is named MyDatabase.

preguntado el 09 de marzo de 12 a las 14:03

It is really hard to understand what is being asked here. You will probably have to clarify your question, otherwise I believe it will be close pretty soon. -

Also, you might wish to address the numerous spelling and grammatical mistakes. -

ProductionTasks.Where(t => t.Designation.Contains("xx")); ? -

@Chris Lively: Well done for stitching a shirt onto that button... -

1 Respuestas

I am not exactly sure what you have asked here. If you need the linq query for above sql statement

var db = new YourDataContext();
var task = from ptask in db.ProductionTasks 
           where ptask.Designation.Contains("xx")
           select ptask;

respondido 09 mar '12, 16:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.