.NET Framework Class Library
Database.GetListFromQuery Method (String, IDictionary)
|
<< Click to Display Table of Contents >> Navigation: MwPDMApi Namespace > Database Class > Database Methods > GetListFromQuery Method > .NET Framework Class Library |
Executes a query against the database, with the specified parameters and returns a list of dynamic objects with the query results. The query must be a valid SQL command that can be executed against the database.
Namespace: MwPDMApi
Assembly: MwPDMApi (in MwPDMApi.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
Visual Basic |
|---|
Public Function GetListFromQuery ( _ query As String, _ |
C# |
|---|
public List<Object> GetListFromQuery( string query, |
Visual C++ |
|---|
public: List<Object^>^ GetListFromQuery( |
JavaScript |
|---|
function getListFromQuery(query, parameters); |
Parameters
query
Type: System.String
The SQL query to execute.
parameters
Type: System.Collections.IDictionary
A dictionary of parameters to use in the query.
Remarks
The query is a standard parameterized query like
|
|
|---|---|
SELECT * FROM DOCUMENT WHERE ID = @id AND DESCRIPTION = @description AND CREATION_DATE = @creationdate |
|
The parameters dictionary must contain the parameter names and values, with or without the '@' symbol. For example:
|
|
|---|---|
Dim parameters As New Dictionary(Of String, Object)() parameters("id") = 1 parameters("description") = "Sample Description" |
|
Or in PowerShell:
|
|
|---|---|
$parameters = @{ id = 1 description = "Sample Description" |
|
The format of the query and the parameters is the standard one for parameterized queries in ADO.NET, with '@' as prefix for parameters in the query, and a dictionary of parameter names and values passed to the method. The parameters type are inferred automatically and correctly managed in most of the standard scenarios.
See Also