LinqConnect Documentation
Devart.Data.Linq Namespace / DataContext Class / Query<TResult> Method
The type of entity, returned by the method.
SQL query code.
Query parameters.

In This Topic
    Query<TResult> Method
    In This Topic
    Executes SQL query against the database, with data fetching delayed until they will be accessed through the IQueryable interface.
    Syntax
    'Declaration
     
    Public Function Query(Of TResult)( _
       ByVal query As String, _
       ByVal ParamArray parameters() As Object _
    ) As IQueryable(Of TResult)
    public IQueryable<TResult> Query<TResult>( 
       string query,
       params object[] parameters
    )

    Parameters

    query
    SQL query code.
    parameters
    Query parameters.

    Type Parameters

    TResult
    The type of entity, returned by the method.

    Return Value

    IQueryable that represents the result of the SQL query execution.
    Remarks

    This method executes SQL query against the database. It returns IQueryable that represents the result of the SQL query execution. This allows dalayed query result fetching and using this method calls as a subquery in LINQ to SQL queries. For example:

    from c in db.Query<Company>("Select * From Company Where CompanyName LIKE {0} ", "motors")
    from o in db.Orders
    where o.CompanyId = c.CompanyId
    select new {c, o}
    
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also