csharp LINQ to SQL ExecuteQuery

List<MyClass> query = db.ExecuteQuery<MyClass>("Select ColumnB From tbl_MyClass Where ColumnA = {0}", "columna").ToList();

if (query.Count > 0)
	if (query.FirstOrDefault().ColumnB)

//MyClass class has to match columns in DB table
public class MyClass
	public int MyClassID { get; set; }
	public string ColumnA { get; set; }
	public bool ColumnB { get; set; }
Executes a dynamic SQL query against the LINQ to SQL database.

Updated: Thursday 19th May 2011, 03:51am

There are 0 comments

Leave a comment of your own

Comments are currently closed.