Interface IDbRequest
A database request that usually calls a SQL stored procedure.
Inherited Members
Namespace: Softadmin.Api.Database
Assembly: Softadmin.Api.dll
Syntax
public interface IDbRequest : IDisposable
Remarks
Requests are executed with ExecuteNonQuery() or GetDataSet(). It is possible to execute the same request more than once, though you'd usually use the IDbRequestFactory to create a new request for each call.
Properties
RequestName
Gets the request's name.
Declaration
string RequestName { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Request names are purely informational. They are used in the profiler log and in error messages.
ReturnCode
Gets the return code from the most recent execution of the request.
Declaration
int ReturnCode { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The request has not been executed yet. |
Methods
AddTempTable(DataTable)
Adds a table that will be created as a temp table before the procedure is called.
Declaration
void AddTempTable(DataTable table)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | table | Data table. Its name will become the temp table's name and must start with a single #. |
ExecuteNonQuery()
Executes the request and ignores its results.
Declaration
void ExecuteNonQuery()
Exceptions
Type | Condition |
---|---|
System.Exception | An error occurred while performing the request. This exception contains meta-data that allows ILogger to log which SQL was called. |
See Also
GetDataSet()
Executes the request and returns its results as a data table.
Declaration
DataSet GetDataSet()
Returns
Type | Description |
---|---|
System.Data.DataSet | Request results. |
Exceptions
Type | Condition |
---|---|
System.Exception | An error occurred while performing the request. This exception contains meta-data that allows ILogger to log which SQL was called. |
See Also
SetParameter(String, Object)
Sets the value of a parameter passed to the procedure. Overwrites any existing parameter with the same name.
Declaration
void SetParameter(string name, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Parameter name. |
System.Object | value | Parameter value. |