.NET Framework Class Library
Database.ExecuteQuery Method (String, IDictionary)
|
<< Click to Display Table of Contents >> Navigation: MwPDMApi Namespace > Database Class > Database Methods > ExecuteQuery Method > .NET Framework Class Library |
Executes a query against the database, with the specified parameters. The query must be a valid SQL command that can be executed against the database. It does not return any result, it is used for commands like INSERT, UPDATE, DELETE, etc.
Namespace: MwPDMApi
Assembly: MwPDMApi (in MwPDMApi.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
Visual Basic |
|---|
Public Sub ExecuteQuery ( _ query As String, _ |
C# |
|---|
public void ExecuteQuery( string query, |
Visual C++ |
|---|
public: void ExecuteQuery( |
JavaScript |
|---|
function executeQuery(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
|
|
|---|---|
INSERT INTO DOCUMENT (ID, DESCRIPTION, CREATION_DATE) VALUES (@id, @description, @creationdate) |
|
The parameters dictionary must contain the parameter names and values, 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