GLOBAL SITES
 Home > Products > OQL.NET Object Query Language > C# Examples

Please refer to online documents for more examples.

OQL Sample 1

// == C# Code ======================================================

SelectQuery qryOrder = OQL

  .SelectWhere(NW.Order == (NW.Customer.ContactTitle == "Owner"));

 

// ==== sql output for Microsoft Sql Server ========================

SELECT [Orders].*

FROM [Orders]

WHERE

  [Orders].[CustomerID] IN

    (

      SELECT [Customers].[CustomerID]

      FROM [Customers]

      WHERE

        [Customers].[ContactTitle] = 'Owner'

    )

 

// ==== sql output for Oracle ======================================

SELECT "Orders".*

FROM "Orders"

WHERE

  "Orders"."CustomerID" IN

    (

      SELECT "Customers"."CustomerID"

      FROM "Customers"

      WHERE

        "Customers"."ContactTitle" = 'Owner'

    ) 

OQL Sample 2

// == C# Code ======================================================

SelectQuery sel = OQL

  .Select(NW.Order.OrderID,NW.Order.OrderDate,NW.Order.RequiredDate)

    ._(NW.OrderDetail)

  .From(NW.Order, NW.OrderDetail)

  .Where(NW.Order.EmployeeID == 5 && NW.Order.ShipVia == 1

    && NW.Order.OrderID == NW.OrderDetail.OrderID)

  .OrderBy(NW.Order.OrderID);

 

==== sql output for Microsoft Sql Server ============================

SELECT

  [Orders].[OrderID] , [Orders].[OrderDate] , [Orders].[RequiredDate]

  , [Order Details].*

FROM

  [Orders] , [Order Details]

WHERE

  [Orders].[EmployeeID] = 5 AND

  [Orders].[ShipVia] = 1 AND

  [Orders].[OrderID] = [Order Details].[OrderID]

ORDER BY [Orders].[OrderID]

 

==== sql output for Oracle =========================================

SELECT

  "Orders"."OrderID" , "Orders"."OrderDate" , "Orders"."RequiredDate"

  , "Order Details".*

FROM

  "Orders" , "Order Details"

WHERE

  "Orders"."EmployeeID" = 5 AND

  "Orders"."ShipVia" = 1 AND

  "Orders"."OrderID" = "Order Details"."OrderID"

ORDER BY "Orders"."OrderID"

Overview
Features
Download
Purchase
Requirements
Video Demo
C# Examples
VB.NET Examples
Online Documents
Word to HTML help Word to Web help CHM to Web help CHM to Word CHM to HTML/MHTML .NET assembly Obfuscator