C# Class Argentini.Halide.H3Reader

The H3Reader class provides a more powerful, flexible SQL reader class.
Inheritance: System.IDisposable
Afficher le fichier Open project: argentini/Halide Class Usage Examples

Méthodes publiques

Свойство Type Description
sqlCommandString string

Méthodes publiques

Méthode Description
Close ( ) : void

Close a previously opened H3Reader object. You must close an opened H3Reader object when finished using it!

ColumnName ( int columnNumber ) : string

Get a column name by its number.

Dispose ( ) : void

Disposes the SmartReader.

GetBoolean ( string columnName ) : bool

Read a column value in as a boolean, by its column name.

GetColumnAllowNulls ( string columnName ) : bool

Does a specified column allow nulls? Returns false if no schema information is available.

GetColumnIsAutoIncrement ( string columnName ) : bool

Is a specified column an auto-incrementing field? Returns false if no schema information is available.

GetColumnIsIdentity ( string columnName ) : bool

Is a specified column an identity? Returns false if no schema information is available.

GetColumnIsKey ( string columnName ) : bool

Is the specified column a primary key? Returns false if no schema information is available.

GetColumnSize ( string columnName ) : int

Get the size (dimension) of the column, or zero if no schema information is available.

GetColumnSystemDataType ( string columnName ) : string

Return a column's equivalent system data type name (e.g. "String", "Int64", et al.). Returns an empty string if no schema information is available.

GetDataTypeName ( int columnIndex ) : string

Retrieve the SQL data type name of a specified column (e.g. "varchar", "int", "smallint", et al.).

GetDataTypeName ( string columnName ) : string

Retrieve the SQL data type name of a specified column (e.g. "varchar", "int", "smallint", et al.).

GetDate ( string columnName ) : string

Read a column value in as a string formatted as a date.

GetDateTime ( string columnName ) : System.DateTime

Read a column value in as a DateTime object.

GetDateTimeNullable ( string columnName ) : DateTime?

Read a column value in as a nullable DateTime object.

GetDecimal ( string columnName ) : decimal

Read a column value in as a decimal.

GetDouble ( string columnName ) : double

Read a column value in as a double.

GetFloat ( string columnName ) : float

Read a column value in as a float.

GetInt ( string columnName ) : int

Read a column value in as an integer.

GetInt32 ( string columnName ) : Int32

Read a column value in as an Int32.

GetInt32Nullable ( string columnName ) : Int32?

Read a column value in as a nullable Int32.

GetInt64 ( string columnName ) : System.Int64

Read a column value in as an Int64.

GetInt64Nullable ( string columnName ) : Int64?

Read a column value in as a nullable Int64.

GetLong ( string columnName ) : long

Read a column value in as a long.

GetMoney ( string columnName ) : string

Read a column value in as a string formatted as money.

GetPrimarykeyName ( ) : string

Get the primary key column name, or an empty string if schema is not available.

GetString ( int columnIndex ) : string

Read a column value in as a string, by its column number.

GetString ( string columnName ) : string

Read a column value in as a string, by its column name.

GetString ( string columnName, string defaultValue ) : string

Read a column value in as a string, by its column name.

GetStringNullable ( string columnName ) : String

Read a column value in as a string by its column name. Can return nulls.

GetStringOfMinutes ( string columnName ) : String

Gets a numeric field that represents minutes (ie 125) and converts it to an hour format (ie 2:05)

GetTime ( string columnName ) : string

Read a column value in as a string formatted as a time.

GetXMLResult ( ) : string

Read an XML result from a stored procedure. Used to bypass the 2,033 byte limit (multiple row) segmentation of XML results when simply requesting the column as a string. Reads in column 0 of all rows in the result set and appends them.

GetYesNo ( string columnName ) : string

Read a column value in and process as "Yes", "No", or "n/a" using the GetBoolean method.

H3Reader ( ) : System

Instantiate the class.

H3Reader ( String commandText, String filePath, String password, ConnectionStrings Connection_String ) : System

Instantiate the class for connecting to an external data source file.

H3Reader ( string commandText ) : System

Instantiate the class by passing a SQL command string.

H3Reader ( string commandText, bool getSchema ) : System

Instantiate the class by passing a SQL command string. Optionally enables getting schema information.

H3Reader ( string commandText, bool getSchema, string connectionName ) : System

Instantiate the class by passing a SQL command string, optionally enables getting schema information, pass a connection string name.

H3Reader ( string commandText, string connectionName ) : System

Instantiate the class by passing a SQL command string and connection string name.

H3Reader ( string commandText, string whereClause, string orderByClause, Int32 perPage, Int32 pageNum ) : System

Instantiate the class by passing a SQL command string, where clause, order by clause, rows per page, and page number, to receive only that page's rows. Only compatible with Microsoft SQL Server 2005 and later. Uses the default "Halide" connection string. If you insert [WHERECLAUSE] within your SELECT statement, you can force the passed where clause to be inserted for you; for advanced queries. The same holds true for [ORDERBY]. Remember NOT to include the "WHERE" or "ORDER BY" text in your passed arguments.

H3Reader ( string commandText, string whereClause, string orderByClause, Int32 perPage, Int32 pageNum, string useConnectionStringName ) : System

Instantiate the class by passing a SQL command string, where clause, order by clause, rows per page, and page number, to receive only that page's rows. Only compatible with Microsoft SQL Server 2005 and later. If you insert [WHERECLAUSE] within your SELECT statement, you can force the passed where clause to be inserted for you; for advanced queries. The same holds true for [ORDERBY]. Remember NOT to include the "WHERE" or "ORDER BY" text in your passed arguments.

IsNullOrEmpty ( string columnName ) : bool

Is a specified column value empty or null?

ListSchema ( ) : string

Retrieve the columns and their schema information as an ASCII text string for output.

NextResult ( ) : bool

Switch to the next result set; for use with SQL statements that return multiple (compound) recordsets.

Read ( ) : bool

Read the first (or next) row in the query.

ReadTable ( ) : DataTable

Create a dynamic DataTable object from a SQL data statement. One use for this method is to create a data source for other controls that want a DataTable, like 3rd party controls.

ReadTable ( System.Boolean addBlank ) : DataTable

Create a dynamic DataTable object from a SQL data statement. One use for this method is to create a data source for other controls that want a DataTable, like 3rd party controls.

this ( Int32 columnIndex ) : String

Shorthand for the GetString method. Returns a record as a string by column number.

this ( String columnName ) : String

Shorthand for the GetString method. Returns a record as a string by name.

Private Methods

Méthode Description
EnumValueOf ( String value, Type enumType ) : Object
ReadByPage ( string commandText, string WhereClause, string OrderByClause, Int32 PerPage, Int32 PageNum ) : void

Used by the constructor to read in a page of results.

StringValueOf ( Enum value ) : String

Method Details

Close() public méthode

Close a previously opened H3Reader object. You must close an opened H3Reader object when finished using it!
public Close ( ) : void
Résultat void

ColumnName() public méthode

Get a column name by its number.
public ColumnName ( int columnNumber ) : string
columnNumber int Number of column to retrieve.
Résultat string

Dispose() public méthode

Disposes the SmartReader.
public Dispose ( ) : void
Résultat void

GetBoolean() public méthode

Read a column value in as a boolean, by its column name.
public GetBoolean ( string columnName ) : bool
columnName string Name of column to retrieve.
Résultat bool

GetColumnAllowNulls() public méthode

Does a specified column allow nulls? Returns false if no schema information is available.
public GetColumnAllowNulls ( string columnName ) : bool
columnName string Name of the column.
Résultat bool

GetColumnIsAutoIncrement() public méthode

Is a specified column an auto-incrementing field? Returns false if no schema information is available.
public GetColumnIsAutoIncrement ( string columnName ) : bool
columnName string Name of the column.
Résultat bool

GetColumnIsIdentity() public méthode

Is a specified column an identity? Returns false if no schema information is available.
public GetColumnIsIdentity ( string columnName ) : bool
columnName string Name of the column.
Résultat bool

GetColumnIsKey() public méthode

Is the specified column a primary key? Returns false if no schema information is available.
public GetColumnIsKey ( string columnName ) : bool
columnName string Name of the column.
Résultat bool

GetColumnSize() public méthode

Get the size (dimension) of the column, or zero if no schema information is available.
public GetColumnSize ( string columnName ) : int
columnName string Name of the column.
Résultat int

GetColumnSystemDataType() public méthode

Return a column's equivalent system data type name (e.g. "String", "Int64", et al.). Returns an empty string if no schema information is available.
public GetColumnSystemDataType ( string columnName ) : string
columnName string Name of the column.
Résultat string

GetDataTypeName() public méthode

Retrieve the SQL data type name of a specified column (e.g. "varchar", "int", "smallint", et al.).
public GetDataTypeName ( int columnIndex ) : string
columnIndex int Number of the column.
Résultat string

GetDataTypeName() public méthode

Retrieve the SQL data type name of a specified column (e.g. "varchar", "int", "smallint", et al.).
public GetDataTypeName ( string columnName ) : string
columnName string Name of the column.
Résultat string

GetDate() public méthode

Read a column value in as a string formatted as a date.
public GetDate ( string columnName ) : string
columnName string Name of column to retrieve
Résultat string

GetDateTime() public méthode

Read a column value in as a DateTime object.
public GetDateTime ( string columnName ) : System.DateTime
columnName string Name of column to retrieve.
Résultat System.DateTime

GetDateTimeNullable() public méthode

Read a column value in as a nullable DateTime object.
public GetDateTimeNullable ( string columnName ) : DateTime?
columnName string Name of column to retrieve.
Résultat DateTime?

GetDecimal() public méthode

Read a column value in as a decimal.
public GetDecimal ( string columnName ) : decimal
columnName string Name of column to retrieve.
Résultat decimal

GetDouble() public méthode

Read a column value in as a double.
public GetDouble ( string columnName ) : double
columnName string Name of column to retrieve.
Résultat double

GetFloat() public méthode

Read a column value in as a float.
public GetFloat ( string columnName ) : float
columnName string Name of column to retrieve.
Résultat float

GetInt() public méthode

Read a column value in as an integer.
public GetInt ( string columnName ) : int
columnName string Name of column to retrieve.
Résultat int

GetInt32() public méthode

Read a column value in as an Int32.
public GetInt32 ( string columnName ) : Int32
columnName string Name of column to retrieve.
Résultat System.Int32

GetInt32Nullable() public méthode

Read a column value in as a nullable Int32.
public GetInt32Nullable ( string columnName ) : Int32?
columnName string Name of column to retrieve.
Résultat Int32?

GetInt64() public méthode

Read a column value in as an Int64.
public GetInt64 ( string columnName ) : System.Int64
columnName string Name of column to retrieve.
Résultat System.Int64

GetInt64Nullable() public méthode

Read a column value in as a nullable Int64.
public GetInt64Nullable ( string columnName ) : Int64?
columnName string Name of column to retrieve.
Résultat Int64?

GetLong() public méthode

Read a column value in as a long.
public GetLong ( string columnName ) : long
columnName string Name of column to retrieve.
Résultat long

GetMoney() public méthode

Read a column value in as a string formatted as money.
public GetMoney ( string columnName ) : string
columnName string Name of column to retrieve.
Résultat string

GetPrimarykeyName() public méthode

Get the primary key column name, or an empty string if schema is not available.
public GetPrimarykeyName ( ) : string
Résultat string

GetString() public méthode

Read a column value in as a string, by its column number.
public GetString ( int columnIndex ) : string
columnIndex int Number of column to retrieve.
Résultat string

GetString() public méthode

Read a column value in as a string, by its column name.
public GetString ( string columnName ) : string
columnName string Name of column to retrieve.
Résultat string

GetString() public méthode

Read a column value in as a string, by its column name.
public GetString ( string columnName, string defaultValue ) : string
columnName string Name of column to retrieve.
defaultValue string Default value to return if string is null or empty.
Résultat string

GetStringNullable() public méthode

Read a column value in as a string by its column name. Can return nulls.
public GetStringNullable ( string columnName ) : String
columnName string Name of column to retrieve.
Résultat String

GetStringOfMinutes() public méthode

Gets a numeric field that represents minutes (ie 125) and converts it to an hour format (ie 2:05)
public GetStringOfMinutes ( string columnName ) : String
columnName string Name of column to retrieve.
Résultat String

GetTime() public méthode

Read a column value in as a string formatted as a time.
public GetTime ( string columnName ) : string
columnName string Name of column to retrieve.
Résultat string

GetXMLResult() public méthode

Read an XML result from a stored procedure. Used to bypass the 2,033 byte limit (multiple row) segmentation of XML results when simply requesting the column as a string. Reads in column 0 of all rows in the result set and appends them.
public GetXMLResult ( ) : string
Résultat string

GetYesNo() public méthode

Read a column value in and process as "Yes", "No", or "n/a" using the GetBoolean method.
public GetYesNo ( string columnName ) : string
columnName string Name of column to retrieve.
Résultat string

H3Reader() public méthode

Instantiate the class.
public H3Reader ( ) : System
Résultat System

H3Reader() public méthode

Instantiate the class for connecting to an external data source file.
public H3Reader ( String commandText, String filePath, String password, ConnectionStrings Connection_String ) : System
commandText String A SQL command to execute.
filePath String Web-style relative path to the file.
password String password for the file, if any, or a blank string.
Connection_String ConnectionStrings H3Reader.ConnectionString constant which defines the file type.
Résultat System

H3Reader() public méthode

Instantiate the class by passing a SQL command string.
public H3Reader ( string commandText ) : System
commandText string A SQL command to execute.
Résultat System

H3Reader() public méthode

Instantiate the class by passing a SQL command string. Optionally enables getting schema information.
public H3Reader ( string commandText, bool getSchema ) : System
commandText string A SQL command to execute.
getSchema bool Determines if schema information should also be retured, enabling various other methods and properties.
Résultat System

H3Reader() public méthode

Instantiate the class by passing a SQL command string, optionally enables getting schema information, pass a connection string name.
public H3Reader ( string commandText, bool getSchema, string connectionName ) : System
commandText string A SQL command to execute.
getSchema bool Determines if schema information should also be retured, enabling various other methods and properties.
connectionName string Name of a connection string within the Web.Config file.
Résultat System

H3Reader() public méthode

Instantiate the class by passing a SQL command string and connection string name.
public H3Reader ( string commandText, string connectionName ) : System
commandText string A SQL command to execute.
connectionName string Name of a connection string within the Web.Config file.
Résultat System

H3Reader() public méthode

Instantiate the class by passing a SQL command string, where clause, order by clause, rows per page, and page number, to receive only that page's rows. Only compatible with Microsoft SQL Server 2005 and later. Uses the default "Halide" connection string. If you insert [WHERECLAUSE] within your SELECT statement, you can force the passed where clause to be inserted for you; for advanced queries. The same holds true for [ORDERBY]. Remember NOT to include the "WHERE" or "ORDER BY" text in your passed arguments.
public H3Reader ( string commandText, string whereClause, string orderByClause, Int32 perPage, Int32 pageNum ) : System
commandText string A SQL command to execute.
whereClause string Where clause without the "Where".
orderByClause string Order BY clause without the "order by".
perPage System.Int32 How many records per page?
pageNum System.Int32 Which page full of records to read.
Résultat System

H3Reader() public méthode

Instantiate the class by passing a SQL command string, where clause, order by clause, rows per page, and page number, to receive only that page's rows. Only compatible with Microsoft SQL Server 2005 and later. If you insert [WHERECLAUSE] within your SELECT statement, you can force the passed where clause to be inserted for you; for advanced queries. The same holds true for [ORDERBY]. Remember NOT to include the "WHERE" or "ORDER BY" text in your passed arguments.
public H3Reader ( string commandText, string whereClause, string orderByClause, Int32 perPage, Int32 pageNum, string useConnectionStringName ) : System
commandText string A SQL command to execute.
whereClause string Where clause without the "Where".
orderByClause string Order BY clause without the "order by".
perPage System.Int32 How many records per page?
pageNum System.Int32 Which page full of records to read.
useConnectionStringName string Which connection string to use from within the Web.config file?
Résultat System

IsNullOrEmpty() public méthode

Is a specified column value empty or null?
public IsNullOrEmpty ( string columnName ) : bool
columnName string Name of column to evaluate.
Résultat bool

ListSchema() public méthode

Retrieve the columns and their schema information as an ASCII text string for output.
public ListSchema ( ) : string
Résultat string

NextResult() public méthode

Switch to the next result set; for use with SQL statements that return multiple (compound) recordsets.
public NextResult ( ) : bool
Résultat bool

Read() public méthode

Read the first (or next) row in the query.
public Read ( ) : bool
Résultat bool

ReadTable() public méthode

Create a dynamic DataTable object from a SQL data statement. One use for this method is to create a data source for other controls that want a DataTable, like 3rd party controls.
public ReadTable ( ) : DataTable
Résultat System.Data.DataTable

ReadTable() public méthode

Create a dynamic DataTable object from a SQL data statement. One use for this method is to create a data source for other controls that want a DataTable, like 3rd party controls.
public ReadTable ( System.Boolean addBlank ) : DataTable
addBlank System.Boolean Determine whether to add a blank row to the end or not.
Résultat System.Data.DataTable

this() public méthode

Shorthand for the GetString method. Returns a record as a string by column number.
public this ( Int32 columnIndex ) : String
columnIndex System.Int32
Résultat String

this() public méthode

Shorthand for the GetString method. Returns a record as a string by name.
public this ( String columnName ) : String
columnName String
Résultat String

Property Details

sqlCommandString public_oe property

SQL Command String.
public string sqlCommandString
Résultat string