C# Класс Argentini.Halide.H3Reader

The H3Reader class provides a more powerful, flexible SQL reader class.
Наследование: System.IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
sqlCommandString string

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

Close() публичный Метод

Close a previously opened H3Reader object. You must close an opened H3Reader object when finished using it!
public Close ( ) : void
Результат void

ColumnName() публичный Метод

Get a column name by its number.
public ColumnName ( int columnNumber ) : string
columnNumber int Number of column to retrieve.
Результат string

Dispose() публичный Метод

Disposes the SmartReader.
public Dispose ( ) : void
Результат void

GetBoolean() публичный Метод

Read a column value in as a boolean, by its column name.
public GetBoolean ( string columnName ) : bool
columnName string Name of column to retrieve.
Результат bool

GetColumnAllowNulls() публичный Метод

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.
Результат bool

GetColumnIsAutoIncrement() публичный Метод

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.
Результат bool

GetColumnIsIdentity() публичный Метод

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.
Результат bool

GetColumnIsKey() публичный Метод

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.
Результат bool

GetColumnSize() публичный Метод

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.
Результат int

GetColumnSystemDataType() публичный Метод

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.
Результат string

GetDataTypeName() публичный Метод

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.
Результат string

GetDataTypeName() публичный Метод

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.
Результат string

GetDate() публичный Метод

Read a column value in as a string formatted as a date.
public GetDate ( string columnName ) : string
columnName string Name of column to retrieve
Результат string

GetDateTime() публичный Метод

Read a column value in as a DateTime object.
public GetDateTime ( string columnName ) : System.DateTime
columnName string Name of column to retrieve.
Результат System.DateTime

GetDateTimeNullable() публичный Метод

Read a column value in as a nullable DateTime object.
public GetDateTimeNullable ( string columnName ) : DateTime?
columnName string Name of column to retrieve.
Результат DateTime?

GetDecimal() публичный Метод

Read a column value in as a decimal.
public GetDecimal ( string columnName ) : decimal
columnName string Name of column to retrieve.
Результат decimal

GetDouble() публичный Метод

Read a column value in as a double.
public GetDouble ( string columnName ) : double
columnName string Name of column to retrieve.
Результат double

GetFloat() публичный Метод

Read a column value in as a float.
public GetFloat ( string columnName ) : float
columnName string Name of column to retrieve.
Результат float

GetInt() публичный Метод

Read a column value in as an integer.
public GetInt ( string columnName ) : int
columnName string Name of column to retrieve.
Результат int

GetInt32() публичный Метод

Read a column value in as an Int32.
public GetInt32 ( string columnName ) : Int32
columnName string Name of column to retrieve.
Результат System.Int32

GetInt32Nullable() публичный Метод

Read a column value in as a nullable Int32.
public GetInt32Nullable ( string columnName ) : Int32?
columnName string Name of column to retrieve.
Результат Int32?

GetInt64() публичный Метод

Read a column value in as an Int64.
public GetInt64 ( string columnName ) : System.Int64
columnName string Name of column to retrieve.
Результат System.Int64

GetInt64Nullable() публичный Метод

Read a column value in as a nullable Int64.
public GetInt64Nullable ( string columnName ) : Int64?
columnName string Name of column to retrieve.
Результат Int64?

GetLong() публичный Метод

Read a column value in as a long.
public GetLong ( string columnName ) : long
columnName string Name of column to retrieve.
Результат long

GetMoney() публичный Метод

Read a column value in as a string formatted as money.
public GetMoney ( string columnName ) : string
columnName string Name of column to retrieve.
Результат string

GetPrimarykeyName() публичный Метод

Get the primary key column name, or an empty string if schema is not available.
public GetPrimarykeyName ( ) : string
Результат string

GetString() публичный Метод

Read a column value in as a string, by its column number.
public GetString ( int columnIndex ) : string
columnIndex int Number of column to retrieve.
Результат string

GetString() публичный Метод

Read a column value in as a string, by its column name.
public GetString ( string columnName ) : string
columnName string Name of column to retrieve.
Результат string

GetString() публичный Метод

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.
Результат string

GetStringNullable() публичный Метод

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.
Результат String

GetStringOfMinutes() публичный Метод

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.
Результат String

GetTime() публичный Метод

Read a column value in as a string formatted as a time.
public GetTime ( string columnName ) : string
columnName string Name of column to retrieve.
Результат string

GetXMLResult() публичный Метод

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
Результат string

GetYesNo() публичный Метод

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.
Результат string

H3Reader() публичный Метод

Instantiate the class.
public H3Reader ( ) : System
Результат System

H3Reader() публичный Метод

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.
Результат System

H3Reader() публичный Метод

Instantiate the class by passing a SQL command string.
public H3Reader ( string commandText ) : System
commandText string A SQL command to execute.
Результат System

H3Reader() публичный Метод

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.
Результат System

H3Reader() публичный Метод

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.
Результат System

H3Reader() публичный Метод

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.
Результат System

H3Reader() публичный Метод

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.
Результат System

H3Reader() публичный Метод

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?
Результат System

IsNullOrEmpty() публичный Метод

Is a specified column value empty or null?
public IsNullOrEmpty ( string columnName ) : bool
columnName string Name of column to evaluate.
Результат bool

ListSchema() публичный Метод

Retrieve the columns and their schema information as an ASCII text string for output.
public ListSchema ( ) : string
Результат string

NextResult() публичный Метод

Switch to the next result set; for use with SQL statements that return multiple (compound) recordsets.
public NextResult ( ) : bool
Результат bool

Read() публичный Метод

Read the first (or next) row in the query.
public Read ( ) : bool
Результат bool

ReadTable() публичный Метод

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
Результат System.Data.DataTable

ReadTable() публичный Метод

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.
Результат System.Data.DataTable

this() публичный Метод

Shorthand for the GetString method. Returns a record as a string by column number.
public this ( Int32 columnIndex ) : String
columnIndex System.Int32
Результат String

this() публичный Метод

Shorthand for the GetString method. Returns a record as a string by name.
public this ( String columnName ) : String
columnName String
Результат String

Описание свойств

sqlCommandString публичное свойство

SQL Command String.
public string sqlCommandString
Результат string