DCSIMG
LINQ To SQL - Executing Text Queries - Gilad Lavian's Blog

Gilad Lavian's Blog

In Development

LINQ To SQL - Executing Text Queries

Executing text queries with LINQ is simple as that...

 

Assuming you have Adventure Works Database installed.

public void DoExecuteQuery()
{
    AdventureWorksDataContext aw = new AdventureWorksDataContext();

    IEnumerable<Employee> employees = 
        aw.ExecuteQuery<Employee>("SELECT * FROM HumanResources.Employee");

    foreach (Employee e in employees)
    {
        Console.WriteLine(e.Title);
    }
}

תוכן התגובה

גיא בורשטיין כתב/ה:

Hi,

The code is not readable via rss.

Why don't you use Copy Source As Html?

# February 25, 2008 10:44 AM

Gilad Lavian כתב/ה:

Thanks guy, will do.

# February 25, 2008 12:57 PM
שלח תגובה

(שדה חובה)  

(שדה חובה)  

(אופציונלי)

(שדה חובה) 

Please add 8 and 2 and type the answer here:


Enter the numbers above: