C# Class Argentini.Halide.H3DataRow

The Halide H3DataRow class is used to load and manipulate an entire row from a database table/view/SP, and uses Halide.DatabaseRow and Halide.DatabaseItem classes as children.

Note that H3DataRow is case-sensitive! So when you use methods like "Exec" which send H3DataRow column values back to a stored procedure, the column names must match the stored procedure names, including case, which also must match the destination table names, including case.

In addition, the "Exec" method will not work with stored procedures that use OUTPUT parameters.

Datei anzeigen Open project: argentini/Halide

Public Properties

Property Type Description
Column DatabaseRow

Public Methods

Method Description
AddColumn ( String columnName, String columnValue ) : System.Boolean

Add a column to the data set in memory. This is useful when stored procedures used for saving data require optional parameters.

ColumnExists ( String columnName ) : System.Boolean

Determine if a column of a specific name exists in the data set.

DeleteColumn ( String columnName ) : System.Boolean

Delete a column from the data set in memory.

DeleteColumn ( int index ) : System.Boolean

Delete a column from the data set in memory.

EmailSanitize ( String columnName ) : void

Strips specific field data of dangerous email header text.

EmailSanitize ( int columnIndex ) : void

Strips specific field data of dangerous email header text.

Exec ( String spName ) : String

Execute the specified stored procedure. Parameters used in the stored procedure must match column names in the currently loaded data row. If so, this method will automatically send the appropriate data to the procedure.

This method is useful for saving the record back to the database, marking a record for deletion, and more.

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

Exec ( String spName, System.Boolean sendAll ) : String

Execute the specified stored procedure. Parameters used in the stored procedure must match column names in the currently loaded data row. If so, this method will automatically send the appropriate data to the procedure.

This method is useful for saving the record back to the database, marking a record for deletion, and more.

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

Exec ( String spName, System.Boolean sendAll, System.Boolean returnsValue ) : String

Execute the specified stored procedure. Parameters used in the stored procedure must match column names in the currently loaded data row. If so, this method will automatically send the appropriate data to the procedure.

This method is useful for saving the record back to the database, marking a record for deletion, and more.

GetPrimarykeyName ( ) : String

Get the primary key column name.

H3DataRow ( Control containerControl ) : System

Instantiate the class with a Control object reference. This is used to read in a group of controls and their values from within the parent control. If using the "Exec()" method, this allows the developer to easily save a submitted form to a database without having to manually process and pass the stord procedure parameters. Uses the default connection string "Halide".

H3DataRow ( Control containerControl, String UseconnectionStringName ) : System

Instantiate the class with a Control object reference. This is used to read in a group of controls and their values from within the parent control. If using the "Exec()" method, this allows the developer to easily save a submitted form to a database without having to manually process and pass the stord procedure parameters.

H3DataRow ( H3DataRowConfig DataCon ) : System

Instantiate the class with a Halide.H3DataRowConfig class variable to specify what should be loaded, and from where. You must specify either 1) a SQL Command, or 2) a Table Name, Primary Key Name and Primary Key Value. SQL command overrides all other parameters.

H3DataRow ( Halide reader ) : System

Instantiate the class with an open H3Reader object.

H3DataRow ( String connectionStringName ) : System

Instantiate the class with a connection string name. This method is primarily for inserting new objects into a database.

H3DataRow ( String sqlCommand, String UseconnectionStringName ) : System

Instantiate the class with a complete SQL statement.

LoadForm ( Control p ) : System.Boolean

Load content from controls. This is done automatically when instantiating the class with a Control object, so use this method with care. Clears existing columns data before load.

LoadForm ( Control p, System.Boolean clearData ) : System.Boolean

Load content from controls. This is done automatically when instantiating the class with a Control object, so use this method with care.

MarkupSanitize ( String columnName ) : void

Strips specific field data of markup.

MarkupSanitize ( int columnIndex ) : void

Strips specific field data of markup.

Sanitize ( SanitizeOptions options ) : void

Sanitize all fields for a specified type of data.

ScriptSanitize ( String columnName ) : void

Strips specific field data of dangerous script markup.

ScriptSanitize ( int columnIndex ) : void

Strips specific field data of dangerous script markup.

SqlSanitize ( String columnName ) : void

Sanitizes specific field data for SQL use by doubling apostrophes.

SqlSanitize ( int columnIndex ) : void

Sanitizes specific field data for SQL use by doubling apostrophes.

this ( String columnName ) : DatabaseItem

Used to quickly retrieve a single column from the database row that has been read.

this ( int x ) : DatabaseItem

Used to quickly retrieve a single column from the database row that has been read.

Method Details

AddColumn() public method

Add a column to the data set in memory. This is useful when stored procedures used for saving data require optional parameters.
public AddColumn ( String columnName, String columnValue ) : System.Boolean
columnName String Name of the new column.
columnValue String Value of the new column.
return System.Boolean

ColumnExists() public method

Determine if a column of a specific name exists in the data set.
public ColumnExists ( String columnName ) : System.Boolean
columnName String Name of the database column.
return System.Boolean

DeleteColumn() public method

Delete a column from the data set in memory.
public DeleteColumn ( String columnName ) : System.Boolean
columnName String Name of the column to delete.
return System.Boolean

DeleteColumn() public method

Delete a column from the data set in memory.
public DeleteColumn ( int index ) : System.Boolean
index int Index number of the column to delete.
return System.Boolean

EmailSanitize() public method

Strips specific field data of dangerous email header text.
public EmailSanitize ( String columnName ) : void
columnName String Name of the data column to process.
return void

EmailSanitize() public method

Strips specific field data of dangerous email header text.
public EmailSanitize ( int columnIndex ) : void
columnIndex int Index of the data column to process.
return void

Exec() public method

Execute the specified stored procedure. Parameters used in the stored procedure must match column names in the currently loaded data row. If so, this method will automatically send the appropriate data to the procedure.

This method is useful for saving the record back to the database, marking a record for deletion, and more.

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 Exec ( String spName ) : String
spName String Name of the stored procedure.
return String

Exec() public method

Execute the specified stored procedure. Parameters used in the stored procedure must match column names in the currently loaded data row. If so, this method will automatically send the appropriate data to the procedure.

This method is useful for saving the record back to the database, marking a record for deletion, and more.

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 Exec ( String spName, System.Boolean sendAll ) : String
spName String Name of the stored procedure.
sendAll System.Boolean Send all columns to the stored procedure as parameters, /// instead of auto-detecting which parameters the procedure wants. This is /// useful when you construct the class using a reader that has disabled the /// feature whereby it loads the schema.
return String

Exec() public method

Execute the specified stored procedure. Parameters used in the stored procedure must match column names in the currently loaded data row. If so, this method will automatically send the appropriate data to the procedure.

This method is useful for saving the record back to the database, marking a record for deletion, and more.

public Exec ( String spName, System.Boolean sendAll, System.Boolean returnsValue ) : String
spName String Name of the stored procedure.
sendAll System.Boolean Send all columns to the stored procedure as parameters, /// instead of auto-detecting which parameters the procedure wants. This is /// useful when you construct the class using a reader that has disabled the /// feature whereby it loads the schema.
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.
return String

GetPrimarykeyName() public method

Get the primary key column name.
public GetPrimarykeyName ( ) : String
return String

H3DataRow() public method

Instantiate the class with a Control object reference. This is used to read in a group of controls and their values from within the parent control. If using the "Exec()" method, this allows the developer to easily save a submitted form to a database without having to manually process and pass the stord procedure parameters. Uses the default connection string "Halide".
public H3DataRow ( Control containerControl ) : System
containerControl System.Web.UI.Control Control object with submitted form data.
return System

H3DataRow() public method

Instantiate the class with a Control object reference. This is used to read in a group of controls and their values from within the parent control. If using the "Exec()" method, this allows the developer to easily save a submitted form to a database without having to manually process and pass the stord procedure parameters.
public H3DataRow ( Control containerControl, String UseconnectionStringName ) : System
containerControl System.Web.UI.Control Control object with submitted form data.
UseconnectionStringName String Name of a connection string within the Web.config file.
return System

H3DataRow() public method

Instantiate the class with a Halide.H3DataRowConfig class variable to specify what should be loaded, and from where. You must specify either 1) a SQL Command, or 2) a Table Name, Primary Key Name and Primary Key Value. SQL command overrides all other parameters.
public H3DataRow ( H3DataRowConfig DataCon ) : System
DataCon H3DataRowConfig Halide.H3DataRowConfig object with database settings.
return System

H3DataRow() public method

Instantiate the class with an open H3Reader object.
public H3DataRow ( Halide reader ) : System
reader Halide Halide.H3Reader object, opened and read().
return System

H3DataRow() public method

Instantiate the class with a connection string name. This method is primarily for inserting new objects into a database.
public H3DataRow ( String connectionStringName ) : System
connectionStringName String A connection string name.
return System

H3DataRow() public method

Instantiate the class with a complete SQL statement.
public H3DataRow ( String sqlCommand, String UseconnectionStringName ) : System
sqlCommand String Complete SQL command string to use for reading the desired row.
UseconnectionStringName String Name of a connection string within the Web.config file.
return System

LoadForm() public method

Load content from controls. This is done automatically when instantiating the class with a Control object, so use this method with care. Clears existing columns data before load.
public LoadForm ( Control p ) : System.Boolean
p System.Web.UI.Control Page object.
return System.Boolean

LoadForm() public method

Load content from controls. This is done automatically when instantiating the class with a Control object, so use this method with care.
public LoadForm ( Control p, System.Boolean clearData ) : System.Boolean
p System.Web.UI.Control Page object.
clearData System.Boolean Clear existing column data or not.
return System.Boolean

MarkupSanitize() public method

Strips specific field data of markup.
public MarkupSanitize ( String columnName ) : void
columnName String Name of the data column to process.
return void

MarkupSanitize() public method

Strips specific field data of markup.
public MarkupSanitize ( int columnIndex ) : void
columnIndex int Index of the data column to process.
return void

Sanitize() public method

Sanitize all fields for a specified type of data.
public Sanitize ( SanitizeOptions options ) : void
options SanitizeOptions SanitizeOptions enum value specifying which type of filtering to run.
return void

ScriptSanitize() public method

Strips specific field data of dangerous script markup.
public ScriptSanitize ( String columnName ) : void
columnName String Name of the data column to process.
return void

ScriptSanitize() public method

Strips specific field data of dangerous script markup.
public ScriptSanitize ( int columnIndex ) : void
columnIndex int Index of the data column to process.
return void

SqlSanitize() public method

Sanitizes specific field data for SQL use by doubling apostrophes.
public SqlSanitize ( String columnName ) : void
columnName String Name of the data column to process.
return void

SqlSanitize() public method

Sanitizes specific field data for SQL use by doubling apostrophes.
public SqlSanitize ( int columnIndex ) : void
columnIndex int Index of the data column to process.
return void

this() public method

Used to quickly retrieve a single column from the database row that has been read.
public this ( String columnName ) : DatabaseItem
columnName String Name of the column to return.
return DatabaseItem

this() public method

Used to quickly retrieve a single column from the database row that has been read.
public this ( int x ) : DatabaseItem
x int Index number of the column to return.
return DatabaseItem

Property Details

Column public_oe property

Access an individual data column using this object (see the DatabaseItem object for methods and properties). The preferred way to access this object is using a H3DataRow object indexer.
public DatabaseRow,Argentini.Halide Column
return DatabaseRow