C# Class Argentini.Halide.H3Sql

The H3Sql class contains methods and properties for performing operations on, or evaluating, SQL databases.
Datei anzeigen Open project: argentini/Halide

Public Methods

Method Description
ConnectionString ( string connectionStringName ) : String

The SQL connection string, retrieved from the web.config file by its name.

Exec ( String statement, String connectionStringName ) : System.Boolean

Execute a SQL stored procedure. Returns true or false indicating error state. Defaults to 30 second timeout period.

Exec ( String statement, String connectionStringName, Int32 timeout ) : System.Boolean

Execute a SQL stored procedure. Returns true or false indicating error state.

Exec ( string statement ) : System.Boolean

Execute a SQL stored procedure. Returns true or false indicating error state. Uses the default connection string "Halide".

ExportCSV ( String select, String connectionStringName, System.Boolean includeHeaders, System.Boolean alwaysUseQuotes, String filePath ) : System.Boolean

Generate CSV data from a SQL Server data request, and write it to a file. Converts quotation marks to """.

ExportCSV ( String select, String connectionStringName, String filePath ) : System.Boolean

Generate CSV data from a SQL Server data request, and write it to a file. Converts quotation marks to """. Includes a header row and quotation marks around all values.

GenerateCSV ( String select, String connectionStringName ) : StringBuilder

Generate CSV data from a SQL Server request. Converts quotation marks to """.

GenerateCSV ( String select, String connectionStringName, System.Boolean includeHeaders, System.Boolean alwaysUseQuotes ) : StringBuilder

Generate CSV data from a SQL Server request. Converts quotation marks to """.

GetSprocParams ( String procedureName, String connectionStringName ) : ].String[

Get names and SQL data types for stored procedure input parameters.

GetSprocParams ( string procedureName ) : ].String[

Get names and SQL data types for stored procedure input parameters. Uses the "Halide" connection string.

Lookup ( String sqlCommand ) : String

Look up a value from a database object. Returns only one string value, so query must only return one value. Uses the connection string named "Halide".

Lookup ( String sqlCommand, String connectionStringName ) : String

Look up a value from a database object. Returns only one string value, so query must only return one value. Defaults to a 30 second timeout.

Lookup ( String sqlCommand, String connectionStringName, Int32 timeout ) : String

Look up a value from a database object. Returns only one string value, so query must only return one value.

LookupBoolean ( String sqlCommand, System.Boolean &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".

LookupBoolean ( String sqlCommand, String connectionStringName, System.Boolean &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value.

LookupDateTime ( String sqlCommand, System.DateTime &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".

LookupDateTime ( String sqlCommand, String connectionStringName, System.DateTime &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value.

LookupDecimal ( String sqlCommand, Decimal &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".

LookupDecimal ( String sqlCommand, String connectionStringName, Decimal &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value.

LookupInt16 ( String sqlCommand, Int16 &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".

LookupInt16 ( String sqlCommand, String connectionStringName, Int16 &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value.

LookupInt32 ( String sqlCommand, Int32 &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".

LookupInt32 ( String sqlCommand, String connectionStringName, Int32 &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value.

LookupInt64 ( String sqlCommand, System.Int64 &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".

LookupInt64 ( String sqlCommand, String connectionStringName, System.Int64 &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value.

LookupString ( String sqlCommand, String &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".

LookupString ( String sqlCommand, String connectionStringName, String &output ) : void

Look up a value from a database object. Returns only one value, so query must only return one value.

PowerExec ( String procedureName, String paramNames, String paramValues, System.Boolean returnsValue, String connectionStringName ) : String

Execute a stored procedure with passed form field names in string array.

PowerExec ( String procedureName, String paramNames, String paramValues, System.Boolean returnsValue, String connectionStringName, Int32 timeOut ) : String

Execute a stored procedure with passed form field names in string array.

PowerExec ( String procedureName, String paramNames, String paramValues, String connectionStringName ) : String

Execute a stored procedure with passed form field names in string array.

This method assumes that the stored procedure returns a value. If it does not, the procedure will execute, but an exception will be thrown.

PowerExec ( string procedureName, string paramNames, string paramValues ) : String

Execute a stored procedure with passed form field names in string array. Uses the default connection string "Halide".

This method assumes that the stored procedure returns a value. If it does not, the procedure will execute, but an exception will be thrown.

ReadTable ( string statement ) : DataTable

Loads the results of a SQL query into a DataTable object. Uses the default connection string "Halide".

ReadTable ( string statement, string connectionStringName ) : DataTable

Loads the results of a SQL query into a DataTable object.

Private Methods

Method Description
H3Sql ( ) : System

Method Details

ConnectionString() public static method

The SQL connection string, retrieved from the web.config file by its name.
public static ConnectionString ( string connectionStringName ) : String
connectionStringName string Name of a connection string within the Web.config file.
return String

Exec() public static method

Execute a SQL stored procedure. Returns true or false indicating error state. Defaults to 30 second timeout period.
public static Exec ( String statement, String connectionStringName ) : System.Boolean
statement String SQL statement to execute.
connectionStringName String Name of a connection string in the Web.config file.
return System.Boolean

Exec() public static method

Execute a SQL stored procedure. Returns true or false indicating error state.
public static Exec ( String statement, String connectionStringName, Int32 timeout ) : System.Boolean
statement String SQL statement to execute.
connectionStringName String Name of a connection string in the Web.config file.
timeout System.Int32 Timeout in seconds for the command to execute; use zero for no timeout period.
return System.Boolean

Exec() public static method

Execute a SQL stored procedure. Returns true or false indicating error state. Uses the default connection string "Halide".
public static Exec ( string statement ) : System.Boolean
statement string SQL statement to execute.
return System.Boolean

ExportCSV() public static method

Generate CSV data from a SQL Server data request, and write it to a file. Converts quotation marks to """.
public static ExportCSV ( String select, String connectionStringName, System.Boolean includeHeaders, System.Boolean alwaysUseQuotes, String filePath ) : System.Boolean
select String SQL Server command to execute, which retrieves a dataset.
connectionStringName String Connection String name in the Web.config file.
includeHeaders System.Boolean Include column names as a header row in the CSV file.
alwaysUseQuotes System.Boolean Wrap all values in quotation marks. False will omit quotation marks around numeric values.
filePath String Web-style path and filename for the output of the data.
return System.Boolean

ExportCSV() public static method

Generate CSV data from a SQL Server data request, and write it to a file. Converts quotation marks to """. Includes a header row and quotation marks around all values.
public static ExportCSV ( String select, String connectionStringName, String filePath ) : System.Boolean
select String SQL Server command to execute, which retrieves a dataset.
connectionStringName String Connection String name in the Web.config file.
filePath String Web-style path and filename for the output of the data.
return System.Boolean

GenerateCSV() public static method

Generate CSV data from a SQL Server request. Converts quotation marks to """.
public static GenerateCSV ( String select, String connectionStringName ) : StringBuilder
select String SQL Server command to execute, which retrieves a dataset.
connectionStringName String Connection String name in the Web.config file.
return StringBuilder

GenerateCSV() public static method

Generate CSV data from a SQL Server request. Converts quotation marks to """.
public static GenerateCSV ( String select, String connectionStringName, System.Boolean includeHeaders, System.Boolean alwaysUseQuotes ) : StringBuilder
select String SQL Server command to execute, which retrieves a dataset.
connectionStringName String Connection String name in the Web.config file.
includeHeaders System.Boolean Include column names as a header row in the CSV file.
alwaysUseQuotes System.Boolean Wrap all values in quotation marks. False will omit quotation marks around numeric values.
return StringBuilder

GetSprocParams() public static method

Get names and SQL data types for stored procedure input parameters.
public static GetSprocParams ( String procedureName, String connectionStringName ) : ].String[
procedureName String Name of the stored procedure.
connectionStringName String Name of a connection string in the Web.config file.
return ].String[

GetSprocParams() public static method

Get names and SQL data types for stored procedure input parameters. Uses the "Halide" connection string.
public static GetSprocParams ( string procedureName ) : ].String[
procedureName string Name of the stored procedure.
return ].String[

Lookup() public static method

Look up a value from a database object. Returns only one string value, so query must only return one value. Uses the connection string named "Halide".
public static Lookup ( String sqlCommand ) : String
sqlCommand String SQL query string for which to return a string value.
return String

Lookup() public static method

Look up a value from a database object. Returns only one string value, so query must only return one value. Defaults to a 30 second timeout.
public static Lookup ( String sqlCommand, String connectionStringName ) : String
sqlCommand String SQL query string for which to return a string value.
connectionStringName String Name of a connection string in the Web.config file.
return String

Lookup() public static method

Look up a value from a database object. Returns only one string value, so query must only return one value.
public static Lookup ( String sqlCommand, String connectionStringName, Int32 timeout ) : String
sqlCommand String SQL query string for which to return a string value.
connectionStringName String Name of a connection string in the Web.config file.
timeout System.Int32 Timeout in seconds for the request. Use zero for no timeout period.
return String

LookupBoolean() public static method

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".
public static LookupBoolean ( String sqlCommand, System.Boolean &output ) : void
sqlCommand String SQL query string for which to return a value.
output System.Boolean Variable to receive the value
return void

LookupBoolean() public static method

Look up a value from a database object. Returns only one value, so query must only return one value.
public static LookupBoolean ( String sqlCommand, String connectionStringName, System.Boolean &output ) : void
sqlCommand String SQL query string for which to return a value.
connectionStringName String Name of a connection string in the Web.config file.
output System.Boolean Variable which receives the result.
return void

LookupDateTime() public static method

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".
public static LookupDateTime ( String sqlCommand, System.DateTime &output ) : void
sqlCommand String SQL query string for which to return a value.
output System.DateTime Variable to receive the value
return void

LookupDateTime() public static method

Look up a value from a database object. Returns only one value, so query must only return one value.
public static LookupDateTime ( String sqlCommand, String connectionStringName, System.DateTime &output ) : void
sqlCommand String SQL query string for which to return a value.
connectionStringName String Name of a connection string in the Web.config file.
output System.DateTime Variable which receives the result.
return void

LookupDecimal() public static method

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".
public static LookupDecimal ( String sqlCommand, Decimal &output ) : void
sqlCommand String SQL query string for which to return a value.
output Decimal Variable to receive the value
return void

LookupDecimal() public static method

Look up a value from a database object. Returns only one value, so query must only return one value.
public static LookupDecimal ( String sqlCommand, String connectionStringName, Decimal &output ) : void
sqlCommand String SQL query string for which to return a value.
connectionStringName String Name of a connection string in the Web.config file.
output Decimal Variable which receives the result.
return void

LookupInt16() public static method

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".
public static LookupInt16 ( String sqlCommand, Int16 &output ) : void
sqlCommand String SQL query string for which to return a value.
output System.Int16 Variable to receive the value
return void

LookupInt16() public static method

Look up a value from a database object. Returns only one value, so query must only return one value.
public static LookupInt16 ( String sqlCommand, String connectionStringName, Int16 &output ) : void
sqlCommand String SQL query string for which to return a value.
connectionStringName String Name of a connection string in the Web.config file.
output System.Int16 Variable which receives the result.
return void

LookupInt32() public static method

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".
public static LookupInt32 ( String sqlCommand, Int32 &output ) : void
sqlCommand String SQL query string for which to return a value.
output System.Int32 Variable to receive the value
return void

LookupInt32() public static method

Look up a value from a database object. Returns only one value, so query must only return one value.
public static LookupInt32 ( String sqlCommand, String connectionStringName, Int32 &output ) : void
sqlCommand String SQL query string for which to return a value.
connectionStringName String Name of a connection string in the Web.config file.
output System.Int32 Variable which receives the result.
return void

LookupInt64() public static method

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".
public static LookupInt64 ( String sqlCommand, System.Int64 &output ) : void
sqlCommand String SQL query string for which to return a value.
output System.Int64 Variable to receive the value
return void

LookupInt64() public static method

Look up a value from a database object. Returns only one value, so query must only return one value.
public static LookupInt64 ( String sqlCommand, String connectionStringName, System.Int64 &output ) : void
sqlCommand String SQL query string for which to return a value.
connectionStringName String Name of a connection string in the Web.config file.
output System.Int64 Variable which receives the result.
return void

LookupString() public static method

Look up a value from a database object. Returns only one value, so query must only return one value. Uses the connection string named "Halide".
public static LookupString ( String sqlCommand, String &output ) : void
sqlCommand String SQL query string for which to return a value.
output String Variable to receive the value
return void

LookupString() public static method

Look up a value from a database object. Returns only one value, so query must only return one value.
public static LookupString ( String sqlCommand, String connectionStringName, String &output ) : void
sqlCommand String SQL query string for which to return a value.
connectionStringName String Name of a connection string in the Web.config file.
output String Variable which receives the result.
return void

PowerExec() public static method

Execute a stored procedure with passed form field names in string array.
public static PowerExec ( String procedureName, String paramNames, String paramValues, System.Boolean returnsValue, String connectionStringName ) : String
procedureName String Name of stored procedure.
paramNames String string array with field names.
paramValues String string array with field values.
returnsValue System.Boolean If the stored procedure returns a value, set to true, /// otherwise, set to false. When false, the number of rows affected is returned as a string.
connectionStringName String Name of a connection string in the Web.config file.
return String

PowerExec() public static method

Execute a stored procedure with passed form field names in string array.
public static PowerExec ( String procedureName, String paramNames, String paramValues, System.Boolean returnsValue, String connectionStringName, Int32 timeOut ) : String
procedureName String Name of stored procedure.
paramNames String string array with field names.
paramValues String string array with field values.
returnsValue System.Boolean If the stored procedure returns a value, set to true, /// otherwise, set to false. When false, the number of rows affected is returned as a string.
connectionStringName String Name of a connection string in the Web.config file.
timeOut System.Int32 SQL Command timeout value.
return String

PowerExec() public static method

Execute a stored procedure with passed form field names in string array.

This method assumes that the stored procedure returns a value. If it does not, the procedure will execute, but an exception will be thrown.

public static PowerExec ( String procedureName, String paramNames, String paramValues, String connectionStringName ) : String
procedureName String Name of stored procedure.
paramNames String string array with field names.
paramValues String string array with field values.
connectionStringName String Name of a connection string in the Web.config file.
return String

PowerExec() public static method

Execute a stored procedure with passed form field names in string array. Uses the default connection string "Halide".

This method assumes that the stored procedure returns a value. If it does not, the procedure will execute, but an exception will be thrown.

public static PowerExec ( string procedureName, string paramNames, string paramValues ) : String
procedureName string Name of stored procedure.
paramNames string string array with field names.
paramValues string string array with field values.
return String

ReadTable() public static method

Loads the results of a SQL query into a DataTable object. Uses the default connection string "Halide".
public static ReadTable ( string statement ) : DataTable
statement string SQL statement to execute.
return System.Data.DataTable

ReadTable() public static method

Loads the results of a SQL query into a DataTable object.
public static ReadTable ( string statement, string connectionStringName ) : DataTable
statement string SQL statement to execute.
connectionStringName string Name of a connection string in the Web.config file.
return System.Data.DataTable