quarta-feira, 2 de abril de 2008

Simple Example Linq Application/ Connection, Access , Query | Exemplo simples de conexão e acesso de uma aplicação usando Linq

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using ClassLibraryLinq;

namespace ConsoleApplication
{
    class Program
    {
        static void Main()
        {
            ProjectsDB _projectsDB = new ProjectsDB(@"Data Source=.;Initial Catalog=Projects;Integrated Security=SSPI;");
            var _resultQuery =
                from _employee in _projectsDB.Employee
                where _employee.Name == "Maria"
                select _employee;

            foreach (var _emplyee in _resultQuery)
            {
                Console.WriteLine(_emplyee.Name.ToString());
            }
            Console.WriteLine("Fim");
            Console.ReadKey();
        }
    }
}

Nenhum comentário: