ODBC

Frends.ODBC.ExecuteQuery / 4.0.0

Summary

Runs SQL through an ODBC driver, which makes it the route to databases with no dedicated Frends Task. Parameters are positional, as ODBC itself requires.

Typical use — legacy and niche databases; prefer the dedicated Task where one exists, since it will handle types more faithfully

Details

Frends version
5.7 and newer
Agent
Crossplatform
Target framework
net8.0

Input parameters.

Name Type Default Example Description
ConnectionStringSecret String Driver={driver};Server=127.0.0.1,1433; Database=UnitTests;DSN=ODBC_testDB;Uid=sa;Pwd=yourStrong!Password;

Connection string.

Query String SELECT * FROM MyTable WHERE ID = ?, INSERT INTO MyTable (id, first_name, last_name) VALUES (?, ?, ?),

Query to be executed in string format.

ParametersInOrder QueryParameter[] [ { Value = "1" }, { Value = "Foo" } { Value = "Bar" } ]

Parameters for the database query.

ExecuteType ExecuteTypes ExecuteReader ExecuteType.ExecuteReader

Specifies how a command string is interpreted. Auto: ExecuteReader for SELECT-query and NonQuery for UPDATE, INSERT, or DELETE statements. ExecuteReader: Use this operation to execute any arbitrary SQL statements in SQL Server if you want the result set to be returned. NonQuery: Use this operation to execute any arbitrary SQL statements in SQL Server if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1. Scalar: Use this operation to execute any arbitrary SQL statements in SQL Server to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.

Possible values:

  • Auto: ExecuteReader for SELECT-query and NonQuery for UPDATE, INSERT, or DELETE statements.

  • NonQuery: Executes a SQL statement against the connection and returns the number of rows affected.

  • Scalar: Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

  • ExecuteReader: Executes the query, and returns an object that can iterate over the entire result set.

An unhandled error has occurred. Reload 🗙