Пример #1
0
 void method5()
 {
     // <Snippet5>
     Northwnd db = new Northwnd(@"c:\northwnd.mdf");
     IEnumerable <Customer> results = db.ExecuteQuery <Customer>
                                          ("SELECT contactname FROM customers WHERE city = {0}",
                                          "London");
     // </Snippet5>
 }
Пример #2
0
        void another()
        {
            Northwnd db = new Northwnd(@"");

            // <Snippet4>
            IEnumerable <Customer> results = db.ExecuteQuery <Customer>(
                "select contactname from customers where city = {0}",
                "London"
                );
            // </Snippet4>
        }
Пример #3
0
 void method4()
 {
     // <Snippet4>
     Northwnd db = new Northwnd(@"c:\northwnd.mdf");
     IEnumerable <Customer> results = db.ExecuteQuery <Customer>
                                          (@"SELECT c1.custid as CustomerID, c2.custName as ContactName
         FROM customer1 as c1, customer2 as c2
         WHERE c1.custid = c2.custid"
                                          );
     // </Snippet4>
 }
Пример #4
0
        static void Main(string[] args)
        {
            Northwnd db = new Northwnd(@"");

            // <Snippet1>
            db.Connection.Close();
            // </Snippet1>

            // <Snippet2>
            using (TransactionScope ts = new TransactionScope())
            {
                db.SubmitChanges();
                ts.Complete();
            }
            // </Snippet2>

            // <Snippet3>
            IEnumerable <Customer> results = db.ExecuteQuery <Customer>(
                @"select c1.custid as CustomerID, c2.custName as ContactName
        from customer1 as c1, customer2 as c2
        where c1.custid = c2.custid"
                );
            // </Snippet3>
        }