LINQ in Action roller

Dynamic Queries with Linq to Sql

Hi Everyone, How would one go about creating a query based on user-selection. For example, I have a list box showing the possible columns (fields) I'd like to include for a DataGridView to display the query result. I'm kind of thinking about setting it up like this: Code Snippet var query = from docs in db.Documents select docs; foreach ( string field in selectedfields) { if (field == "Document_Number" ) { query = from docs in query select new { docs.Document_Number }; } if (field == "Revision_Number" Read More...
Published Tuesday, July 31, 2007 3:49 PM by MSDN Forums: LINQ Project General
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication