SqlHelper class

namespace: Serenity.Data   assemblySerenity.Net.Data

Contains static SQL related helper functions and extensions.

public static class SqlHelper

Public Members

name description
static AddParamWithValue(…) Adds the parameter with value to the target command.
static Execute(…) Executes the specified query on connection. (5 methods)
static ExecuteAndGetID(…) Executes the query and returns the generated identity value. Only works for auto incremented fields, not GUIDs.
static ExecuteNonQuery(…) Executes the SQL statement, and returns affected rows. (3 methods)
static ExecuteReader(…) Executes the command returning a data reader. (6 methods)
static ExecuteScalar(…) Executes the statement returning a scalar value. (4 methods)
static Exists(…) Executes the query returning true if it has at least one result.
static FixCommandText(…) Fixes the command text for target dialect by replacing brackets ([]), and parameter prefixes (@).
static FixParamType(…) Fixes the type of the parameter to something suitable as SQL parameter.
static LogCommand(…) Logs the command.
static NewCommand(…) Creates new command. (2 methods)

See Also