TDevFramework

TierDeveloper Framework API

TDevFramework Namespace

Namespace hierarchy

Classes

Class | Description
Collection | This class is a wrapper around the System.Collections.CollectionBase.
Command | This is an abstract class that defines the required interface that must be implemented by each of the .NET Data Provider specific Command classes. The purpose of Command (and thus its inherited implementation classes) class is to facilitate the construction of a Command object and its related objects that includes Parameter and DataSet.
ConfigurationSettings | This is a utility class that is provided to parse the resource file and reads its properties. It reads the appSettings section of the config file associated with the calling assembly. The config file settings are stored in a Hashtable structure as a collection of name/value pairs.
Connection | This is an abstract class that defines the required interface that must be implemented by each of the .NET Data Provider specific Connection classes. The purpose of the Connection (and thus its inherited implementation classes) class is to facilitate the construction of a Connection object.
DbObject | This class serves as the base class for the ComponentFactory class and provides data-access specific operations that are based on ADO.NET framework.
OleDbCommand | This class is derived from TDevFramework Command class and provides the implementation for the .NET Data Provider for OLE DB. The purpose of this class is to facilitate the construction of a OleDbCommand object and its related objects that includes Parameter and DataSet.
OleDbConnection | This is a derivation of the TDevFramework “Connection” class and provides the implementation for the .NET Data Provider for OLE DB. The purpose of this class is to facilitate the construction of an OleDbConnection object.
OracleCommand | This class is derived from TDevFramework “Command” class and provides the implementation for the .NET native Data Provider for Oracle. The purpose of this class is to facilitate the construction of an OracleCommand object and its related objects that includes Parameter and DataSet.
OracleConnection | This is a derivation of the TDevFramework “Connection” class and provides the implementation for the .NET native Data Provider for Oracle. The purpose of this class is to facilitate the construction of an OracleConnection object.
PersistentField | This class manages the state information for the individual attribute for an Object.
PersistentMembershipField | This class inherits from PersistentField and provides the functionality to manage the state information for drop-down LOV attributes for an Object.
PersistentObject | This class serves as the base class for the Component info class and provides state management specific operations for the attributes related with the Object.
PersistentRangeField | This class inherits from PersistentField and provides the functionality to manage the state information for the attributes that have some range values associated.
SqlCommand | This class is derived from TDevFramework “Command” class and provides the implementation for the .NET native Data Provider for SQL Server. The purpose of this class is to facilitate the construction of an SqlCommand object and its related objects that includes Parameter and DataSet.
SqlConnection | This is a derivation of the TDevFramework “Connection” class and provides the implementation for the .NET native Data Provider for SQL Server. The purpose of this class is to facilitate the construction of an SqlConnection object.

Enumerations

Enumeration | Description
EDataType | It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute. The list of available data types is shown below. Each data type corresponds to a .NET data type.
EDBProvider | It is used to specify the .NET Data Provider type during the creation of the ComponentFactory class that calls the base class i.e. DbObject constructor and passes on of the supported .NET Data Provider values. The DbObject class constructs the specific objects for Command and Connection classes based on this value.
EParamDirection | It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
EStatus | It represents the status for a transaction and is used in SetStatus method of TDevFramework Connection class that causes the transaction to complete or abort based on this value.

Send comments on this topic.

Copyright © 2005-2006 Alachisoft. All rights reserved.


Collection Class

This class is a wrapper around the System.Collections.CollectionBase.

For a list of all members of this type, see Collection Members.

System.Object
System.Collections.CollectionBase
TDevFramework.Collection

public class Collection : CollectionBase

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Collection class is a wrapper around the System.Collections.CollectionBase and provides the additional facility to maintain collection of deleted items. It is specifically helpful in context of parent-child relationships where the client can determine the collection of the deleted items from the child collection.

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

Collection Members | TDevFramework Namespace


Collection Members

Collection overview

Public Instance Constructors

Collection Constructor Initializes a new instance of collecton class.

Public Instance Properties

Capacity (inherited from CollectionBase) |
Count (inherited from CollectionBase) |
Items | This is a read-only property that returns collection of the items.
MarkedAddedItems | This is a read-only property that returns collection of the added items.
MarkedDeletedItems | This is a read-only property that returns collection of the deleted items.

Public Instance Methods

Add | Overloaded. Adds an object to the end of collection.
Clear (inherited from CollectionBase) |
Contains | Determines whether the collection contains a specific value.
Equals (inherited from Object) |
GetEnumerator (inherited from CollectionBase) |
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IndexOf | When implemented by a class, determines the index of a specific item in the collection.
Remove | Removes the first occurrence of a specific object from the collection and adds that object in the collection of deleted items.
RemoveAt (inherited from CollectionBase) |
Sort | Overloaded. Sorts the elements in the entire collection.
ToString (inherited from Object) |

Protected Instance Properties

InnerList (inherited from CollectionBase)
List (inherited from CollectionBase)

Protected Instance Methods

Finalize (inherited from Object) |
Load |
MemberwiseClone (inherited from Object) |
OnClear (inherited from CollectionBase) |
OnClearComplete (inherited from CollectionBase) |
OnInsert (inherited from CollectionBase) |
OnInsertComplete (inherited from CollectionBase) |
OnRemove | Performs additional custom processes when removing an element from the collection.
OnRemoveComplete (inherited from CollectionBase) |
OnSet (inherited from CollectionBase) |
OnSetComplete (inherited from CollectionBase) |
OnValidate (inherited from CollectionBase) |

See Also

Collection Class | TDevFramework Namespace


Collection Constructor

Initializes a new instance of collecton class.

public Collection();

See Also

Collection Class | TDevFramework Namespace


Collection Properties

The properties of the Collection class are listed below. For a complete list of Collection class members, see the Collection Members topic.

Public Instance Properties

Capacity (inherited from CollectionBase) |
Count (inherited from CollectionBase) |
Items | This is a read-only property that returns collection of the items.
MarkedAddedItems | This is a read-only property that returns collection of the added items.
MarkedDeletedItems | This is a read-only property that returns collection of the deleted items.

Protected Instance Properties

InnerList (inherited from CollectionBase)
List (inherited from CollectionBase)

See Also

Collection Class | TDevFramework Namespace


Items Property

TierDeveloper Framework API

Collection.Items Property

This is a read-only property that returns collection of the items.

public System.Collections.ArrayList Items {get;}

See Also

Collection Class | TDevFramework Namespace


MarkedAddedItems Property

TierDeveloper Framework API

Collection.MarkedAddedItems Property

This is a read-only property that returns collection of the added items.

public System.Collections.ArrayList MarkedAddedItems {get;}

See Also

Collection Class | TDevFramework Namespace


MarkedDeletedItems Property

TierDeveloper Framework API

Collection.MarkedDeletedItems Property

This is a read-only property that returns collection of the deleted items.

public System.Collections.ArrayList MarkedDeletedItems {get;}

See Also

Collection Class | TDevFramework Namespace


Collection Methods

The methods of the Collection class are listed below. For a complete list of Collection class members, see the Collection Members topic.

Public Instance Methods

Add | Overloaded. Adds an object to the end of collection.
Clear (inherited from CollectionBase) |
Contains | Determines whether the collection contains a specific value.
Equals (inherited from Object) |
GetEnumerator (inherited from CollectionBase) |
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IndexOf | When implemented by a class, determines the index of a specific item in the collection.
Remove | Removes the first occurrence of a specific object from the collection and adds that object in the collection of deleted items.
RemoveAt (inherited from CollectionBase) |
Sort | Overloaded. Sorts the elements in the entire collection.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
Load |
MemberwiseClone (inherited from Object) |
OnClear (inherited from CollectionBase) |
OnClearComplete (inherited from CollectionBase) |
OnInsert (inherited from CollectionBase) |
OnInsertComplete (inherited from CollectionBase) |
OnRemove | Performs additional custom processes when removing an element from the collection.
OnRemoveComplete (inherited from CollectionBase) |
OnSet (inherited from CollectionBase) |
OnSetComplete (inherited from CollectionBase) |
OnValidate (inherited from CollectionBase) |

See Also

Collection Class | TDevFramework Namespace


Add Method

TierDeveloper Framework API

Collection.Add Method

Adds an object to the end of collection.

Overload List

Adds an object to the end of collection.

public void Add(object);

Adds an object to the end of collection as well as in the collection of added items.

public void Add(object,bool);

See Also

Collection Class | TDevFramework Namespace


Collection.Add Method (Object)

Adds an object to the end of collection.

public void Add(
object value
);

Parameters

value
The object to add to the collection.

See Also

Collection Class | TDevFramework Namespace | Collection.Add Overload List


Collection.Add Method (Object, Boolean)

Adds an object to the end of collection as well as in the collection of added items.

public void Add(
object value,
bool bMarkAsAdded
);

Parameters

value
The object to add to the collection.
bMarkAsAdded
Specifies whether to add the object in the collection of added item.

See Also

Collection Class | TDevFramework Namespace | Collection.Add Overload List


Collection.Contains Method

Determines whether the collection contains a specific value.

public bool Contains(
object value
);

Parameters

value
The object to locate in the collection.

Return Value

True if the object is found in the collection; otherwise, false.

See Also

Collection Class | TDevFramework Namespace


Collection.IndexOf Method

When implemented by a class, determines the index of a specific item in the collection.

public int IndexOf(
object value
);

Parameters

value
The object to locate in the collection

Return Value

The index of object if found in the collection; otherwise, -1.

See Also

Collection Class | TDevFramework Namespace


Collection.Load Method

protected void Load(
DataColumnCollection dcColl,
DataRow dRow,
object obj
);

Parameters

dcColl
dRow
obj

See Also

Collection Class | TDevFramework Namespace


Collection.OnRemove Method

Performs additional custom processes when removing an element from the collection.

protected override void OnRemove(
int index,
object value
);

Parameters

index
The zero-based index at which value can be found.
value
The value of the element to remove from index.

See Also

Collection Class | TDevFramework Namespace


Collection.Remove Method

Removes the first occurrence of a specific object from the collection and adds that object in the collection of deleted items.

public void Remove(
object value
);

Parameters

value
The object to remove from the collection.

See Also

Collection Class | TDevFramework Namespace


Sort Method

TierDeveloper Framework API

Collection.Sort Method

Sorts the elements in the entire collection.

Overload List

Sorts the elements in the entire collection.

public void Sort();

Sorts the elements in the entire collection using the specified comparer.

public void Sort(IComparer);

Sorts the elements in the entire collection using the specified comparer.

public void Sort(int,int,IComparer);

See Also

Collection Class | TDevFramework Namespace


Collection.Sort Method ()

Sorts the elements in the entire collection.

public void Sort();

See Also

Collection Class | TDevFramework Namespace | Collection.Sort Overload List


Collection.Sort Method (IComparer)

Sorts the elements in the entire collection using the specified comparer.

public void Sort(
IComparer comparer
);

Parameters

comparer
The IComparer implementation to use when comparing elements

See Also

Collection Class | TDevFramework Namespace | Collection.Sort Overload List


Collection.Sort Method (Int32, Int32, IComparer)

Sorts the elements in the entire collection using the specified comparer.

public void Sort(
int index,
int count,
IComparer comparer
);

Parameters

index
The zero-based starting index of the range to sort.
count
The length of the range to sort.
comparer
The IComparer implementation to use when comparing elements

See Also

Collection Class | TDevFramework Namespace | Collection.Sort Overload List


Command Class

This is an abstract class that defines the required interface that must be implemented by each of the .NET Data Provider specific Command classes. The purpose of Command (and thus its inherited implementation classes) class is to facilitate the construction of a Command object and its related objects that includes Parameter and DataSet.

For a list of all members of this type, see Command Members.

System.Object
TDevFramework.Command
TDevFramework.OleDbCommand
TDevFramework.OracleCommand
TDevFramework.SqlCommand

public abstract class Command

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Command features the following methods for executing commands at a Server database: ExecuteReader executes commands that return rows. For increased performance, ExecuteReader invokes commands using the Transact-SQL sp_executesql system stored procedure. As a result, ExecuteReader may not have the desired effect if used to execute commands such as Transact-SQL SET statements. ExecuteNonQuery executes commands such as Transact-SQL INSERT, DELETE, UPDATE, and SET statements. ExecuteScalar retrieves a single value (for example, an aggregate value) from a database.

Example

 [C#]

 // The following example creates a SqlCommand using TDevFramework.SqlCommand class.

 public void UseCommand(Course objInfo,string myConnectionString)
 {
        const String STD_UPDATE_SQL = @"UPDATE Course SET course_name = ? , credit_hours = ? WHERE course_id = ?";
        bool USE_STORE_PROC =  false;

     // If the connection string is null, use a default.
        if(myConnectionString == "")
        {
            myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.SqlCommand(myConnection);
        myCommand.Prepare(STD_UPDATE_SQL, USE_STORE_PROC);
        myConnection.BeginTransaction();

        // Now add parameter to your myCommand object e.g.
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
        myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

        myCommand.ExecuteNonQuery();

        myConnection.SetStatus();
        // Always close your  connection.
        myConnection.CloseConnection();
 }

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

Command Members | TDevFramework Namespace


Command Members

Command overview

Public Instance Constructors

Command Constructor Default constructor.

Public Instance Properties

Transaction Gets or sets the current transaction.

Public Instance Methods

AddParameter | Overloaded. This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around DataReader.GetBytes method.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getParameterValue | This method returns the value for the specified parameter from the parameters collection associated with the Command object.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
IsNull | Overloaded. This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
Prepare | This method constructs the.NET Data Provider specific Command object.
PrepareNew | This method creates a new .NET Data Provider specific Command object if it not created.
ProcessDataSet | Overloaded. This method synchronizes the target schema with the updated information in the DataSet object parameter.
Read | This is a wrapper method and makes call to the Read method of DataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReadBytes | This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.
Release | This method closes the DataReader object associated with the Command object and disposes the Command object.
ReleaseReader | This method release the DataReader object associated with the Command object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
getParamDirection | Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet
MemberwiseClone (inherited from Object) |

See Also

Command Class | TDevFramework Namespace


Command Constructor

Default constructor.

public Command();

See Also

Command Class | TDevFramework Namespace


Command Properties

The properties of the Command class are listed below. For a complete list of Command class members, see the Command Members topic.

Public Instance Properties

Transaction Gets or sets the current transaction.

See Also

Command Class | TDevFramework Namespace


Transaction Property

TierDeveloper Framework API

Command.Transaction Property

Gets or sets the current transaction.

public abstract object Transaction {get; set;}

See Also

Command Class | TDevFramework Namespace


Command Methods

The methods of the Command class are listed below. For a complete list of Command class members, see the Command Members topic.

Public Instance Methods

AddParameter | Overloaded. This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around DataReader.GetBytes method.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getParameterValue | This method returns the value for the specified parameter from the parameters collection associated with the Command object.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
IsNull | Overloaded. This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
Prepare | This method constructs the.NET Data Provider specific Command object.
PrepareNew | This method creates a new .NET Data Provider specific Command object if it not created.
ProcessDataSet | Overloaded. This method synchronizes the target schema with the updated information in the DataSet object parameter.
Read | This is a wrapper method and makes call to the Read method of DataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReadBytes | This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.
Release | This method closes the DataReader object associated with the Command object and disposes the Command object.
ReleaseReader | This method release the DataReader object associated with the Command object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
getParamDirection | Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet
MemberwiseClone (inherited from Object) |

See Also

Command Class | TDevFramework Namespace


AddParameter Method

TierDeveloper Framework API

Command.AddParameter Method

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

Overload List

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(string,EDataType,object,EParamDirection);

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(string,EDataType,object,EParamDirection,bool);

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(string,EDataType,object,EParamDirection,int);

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(string,EDataType,object,EParamDirection,int,bool);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(string,EDataType,EParamDirection);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(string,EDataType,EParamDirection,int);

See Also

Command Class | TDevFramework Namespace


Command.AddParameter Method (String, EDataType, Object, EParamDirection)

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

See Also

Command Class | TDevFramework Namespace | Command.AddParameter Overload List


Command.AddParameter Method (String, EDataType, Object, EParamDirection, Boolean)

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
bool bNull
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
bNull
Determine whether value is null or not.

See Also

Command Class | TDevFramework Namespace | Command.AddParameter Overload List


Command.AddParameter Method (String, EDataType, Object, EParamDirection, Int32)

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

See Also

Command Class | TDevFramework Namespace | Command.AddParameter Overload List


Command.AddParameter Method (String, EDataType, Object, EParamDirection, Int32, Boolean)

This method constructs the Parameter object and adds it in the Parameters collection. The eType method parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size,
bool bNull
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size
bNull
Determine whether value is null or not.

See Also

Command Class | TDevFramework Namespace | Command.AddParameter Overload List


Command.AddParameter Method (String, EDataType, EParamDirection)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(
string name,
EDataType eType,
EParamDirection direction
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

See Also

Command Class | TDevFramework Namespace | Command.AddParameter Overload List


Command.AddParameter Method (String, EDataType, EParamDirection, Int32)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public abstract void AddParameter(
string name,
EDataType eType,
EParamDirection direction,
int size
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

See Also

Command Class | TDevFramework Namespace | Command.AddParameter Overload List


Command.ExecuteNonQuery Method

Executes a Transact-SQL statement against the connection and returns the number of rows affected.

public abstract int ExecuteNonQuery();

Return Value

number of rows affected

See Also

Command Class | TDevFramework Namespace


Command.ExecuteReader Method

Executes commands that return rows.

public abstract void ExecuteReader();

See Also

Command Class | TDevFramework Namespace


Command.ExecuteScalar Method

Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.

public abstract object ExecuteScalar();

Return Value

See Also

Command Class | TDevFramework Namespace


Command.getBytes Method

This method is a wrapper around DataReader.GetBytes method.

public abstract byte[] getBytes(
string columnName
);

Parameters

columnName

Return Value

Returns array of bytes.

See Also

Command Class | TDevFramework Namespace


Command.getByteSize Method

This method returns total number of bytes in the target binary attribute.

public abstract long getByteSize(
string columnName
);

Parameters

columnName

Return Value

long.

See Also

Command Class | TDevFramework Namespace


Command.GetDataSet Method

This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.

public abstract DataSet GetDataSet(
string tableName
);

Return Value

DataSet object

See Also

Command Class | TDevFramework Namespace


Command.getFieldCount Method

This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.

public abstract int getFieldCount();

Return Value

int

See Also

Command Class | TDevFramework Namespace


Command.getFieldName Method

This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.

public abstract string getFieldName(
int index
);

Parameters

index

Return Value

string

See Also

Command Class | TDevFramework Namespace


Command.getParamDirection Method

Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet

protected ParameterDirection getParamDirection(
EParamDirection direction
);

Parameters

direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Return Value

ParameterDirection

See Also

Command Class | TDevFramework Namespace


Command.getParameterValue Method

This method returns the value for the specified parameter from the parameters collection associated with the Command object.

public abstract object getParameterValue(
string parameterName
);

Parameters

parameterName
Specified parameter from the parameters collection associated with the Command object.

Return Value

object i.e. value for the specified parameter.

See Also

Command Class | TDevFramework Namespace


getValue Method

TierDeveloper Framework API

Command.getValue Method

This method returns the value of the specific column in the current row.

Overload List

This method returns the value of the specific column in the current row.

public abstract object getValue(int);

This method returns the value of the specific column in the current row.

public abstract object getValue(string);

See Also

Command Class | TDevFramework Namespace


Command.getValue Method (Int32)

This method returns the value of the specific column in the current row.

public abstract object getValue(
int colIndex
);

Parameters

colIndex
Specify index of the column.

Return Value

Returns an object.i.e Value of the specific column.

See Also

Command Class | TDevFramework Namespace | Command.getValue Overload List


Command.getValue Method (String)

This method returns the value of the specific column in the current row.

public abstract object getValue(
string columnName
);

Parameters

columnName
Name of column of a table

Return Value

Returns an object.i.e Value of the specific column.

See Also

Command Class | TDevFramework Namespace | Command.getValue Overload List


IsNull Method

TierDeveloper Framework API

Command.IsNull Method

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

Overload List

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public abstract bool IsNull(int);

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public abstract bool IsNull(string);

See Also

Command Class | TDevFramework Namespace


Command.IsNull Method (Int32)

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public abstract bool IsNull(
int colIndex
);

Parameters

colIndex
Index of the column.

Return Value

Returns bool value either true or false.

See Also

Command Class | TDevFramework Namespace | Command.IsNull Overload List


Command.IsNull Method (String)

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public abstract bool IsNull(
string columnName
);

Parameters

columnName
Name of the column of a specific table.

Return Value

Returns bool value either true or false.

See Also

Command Class | TDevFramework Namespace | Command.IsNull Overload List


Command.PopulateDataSet Method

This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.

public abstract void PopulateDataSet(
string dataTableName,
ref DataSet dataSet
);

Parameters

dataTableName
Name of the table.
dataSet
Pass DataSet object by reference.

See Also

Command Class | TDevFramework Namespace


Command.Prepare Method

This method constructs the.NET Data Provider specific Command object.

public abstract void Prepare(
string commandString,
bool isStoredProc
);

Parameters

commandString
Used to specify the command.
isStoredProc
Boolean variable to specify whether command is to be created for Stored Procedure or not.

See Also

Command Class | TDevFramework Namespace


Command.PrepareNew Method

This method creates a new .NET Data Provider specific Command object if it not created.

public abstract void PrepareNew(
string commandString,
bool isStoredProc
);

Parameters

commandString
Used to specify the command.
isStoredProc
Boolean variable to specify whether command is to be created for Stored Procedure or not.

See Also

Command Class | TDevFramework Namespace


ProcessDataSet Method

TierDeveloper Framework API

Command.ProcessDataSet Method

This method synchronizes the target schema with the updated information in the DataSet object parameter.

Overload List

This method synchronizes the target schema with the updated information in the DataSet object parameter.

public abstract void ProcessDataSet(DataSet);

This method synchronizes the target schema with the updated information in the DataSet object parameter.

public abstract void ProcessDataSet(string,DataSet);

See Also

Command Class | TDevFramework Namespace


Command.ProcessDataSet Method (DataSet)

This method synchronizes the target schema with the updated information in the DataSet object parameter.

public abstract void ProcessDataSet(
DataSet dataSet
);

Parameters

dataSet
Object of DataSet.

See Also

Command Class | TDevFramework Namespace | Command.ProcessDataSet Overload List


Command.ProcessDataSet Method (String, DataSet)

This method synchronizes the target schema with the updated information in the DataSet object parameter.

public abstract void ProcessDataSet(
string dataTableName,
DataSet dataSet
);

Parameters

dataTableName
dataSet
Object of DataSet.

See Also

Command Class | TDevFramework Namespace | Command.ProcessDataSet Overload List


Command.Read Method

This is a wrapper method and makes call to the Read method of DataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.

public abstract bool Read();

Return Value

Returns bool value either true or false.

See Also

Command Class | TDevFramework Namespace


Command.ReadBytes Method

This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.

public abstract void ReadBytes(
string columnName,
long dataIndex,
byte[] buffer,
int buffIndex,
int length
);

Parameters

columnName
Name of the column
dataIndex
buffer
buffer array of byte type.
buffIndex
Index of buffer
length
length

See Also

Command Class | TDevFramework Namespace


Command.Release Method

This method closes the DataReader object associated with the Command object and disposes the Command object.

public abstract void Release();

See Also

Command Class | TDevFramework Namespace


Command.ReleaseReader Method

This method release the DataReader object associated with the Command object.

public abstract void ReleaseReader();

See Also

Command Class | TDevFramework Namespace


ConfigurationSettings Class

This is a utility class that is provided to parse the resource file and reads its properties. It reads the appSettings section of the config file associated with the calling assembly. The config file settings are stored in a Hashtable structure as a collection of name/value pairs.

For a list of all members of this type, see ConfigurationSettings Members.

System.Object
TDevFramework.ConfigurationSettings

public abstract class ConfigurationSettings

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

ConfigurationSettings Members | TDevFramework Namespace


ConfigurationSettings Members

ConfigurationSettings overview

Public Static Properties

AppSettings Reads the appSettings section of the config file associated with the calling assembly.

Public Instance Methods

Equals (inherited from Object)
GetHashCode (inherited from Object)
GetType (inherited from Object)
ToString (inherited from Object)

Protected Instance Constructors

ConfigurationSettings Constructor Initializes a new instance of the ConfigurationSettings class.

Protected Instance Methods

Finalize (inherited from Object)
MemberwiseClone (inherited from Object)

See Also

ConfigurationSettings Class | TDevFramework Namespace


ConfigurationSettings Constructor

Initializes a new instance of the ConfigurationSettings class.

protected ConfigurationSettings();

See Also

ConfigurationSettings Class | TDevFramework Namespace


ConfigurationSettings Properties

The properties of the ConfigurationSettings class are listed below. For a complete list of ConfigurationSettings class members, see the ConfigurationSettings Members topic.

Public Static Properties

AppSettings Reads the appSettings section of the config file associated with the calling assembly.

See Also

ConfigurationSettings Class | TDevFramework Namespace


AppSettings Property

TierDeveloper Framework API

ConfigurationSettings.AppSettings Property

Reads the appSettings section of the config file associated with the calling assembly.

public static System.Collections.Specialized.NameValueCollection AppSettings {get;}

Remarks

This cannot be used by assemblies loaded from byte arrays.

@version 05-10-2004 (ssalas) - when assembly in GAC, pull config file from base dir of current app domain

@version 05-10-2004 (ssalas) - tracks config settings per calling assembly

@version 12-01-2002 (bwaldron) - created

Exceptions

Exception Type | Condition
FileNotFoundException | If config file for calling assembly cannot be found or accessed.
ConfigurationException | If config file for calling assembly contains invalid content or cannot be read.

See Also

ConfigurationSettings Class | TDevFramework Namespace


Connection Class

This is an abstract class that defines the required interface that must be implemented by each of the .NET Data Provider specific Connection classes. The purpose of the Connection (and thus its inherited implementation classes) class is to facilitate the construction of a Connection object.

For a list of all members of this type, see Connection Members.

System.Object
TDevFramework.Connection
TDevFramework.OleDbConnection
TDevFramework.OracleConnection
TDevFramework.SqlConnection

public abstract class Connection

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

A Connection object represents a unique session to a Server data source. In the case of a client/server database system, it is equivalent to a network connection to the server.

Example

[C#]

// The following example creates a SqlConnection using TDevFramework.SqlConnection class.

 public void CreateConnection(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();
}

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

Connection Members | TDevFramework Namespace


Connection Members

Connection overview

Public Instance Constructors

Connection Overloaded. Initializes a new instance of the Connection class.

Public Instance Properties

Transaction Gets the current transaction.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
CloseConnection | This method closes the currently opened connection and sets the IsOpen flag to false.
CreateCommand | This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.
Equals (inherited from Object) |
getConnection | This method returns the .NET Data Provider specific Connection object i.e. OleDbConnection, OracleConnection or SqlConnection.
getConnectionString | Gets the connection string.
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IsManualTransaction | Determines whether transaction is manual or not.
IsOpen | Determines whether connection is open or not and return true or false accordingly.
OpenConnection | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
SetAbort | This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.
SetManualTransaction | This method sets the transaction as manual.
SetStatus | This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.
ToString (inherited from Object) |

Protected Instance Constructors

Connection Overloaded. Initializes a new instance of the Connection class.

Protected Instance Fields

_connectionString | Used to specify the connectin string.
_isManualTransaction | Used to see whether transaction is manually started or not.
_isOpen | Used to see whether connectin is open or close.

Protected Instance Methods

Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
setOpen | This method sets the _isOpen property to true or false.

See Also

Connection Class | TDevFramework Namespace


Connection Constructor

Initializes a new instance of the Connection class.

Overload List

Initializes a new instance of the Connection class.

protected Connection();

Initializes a new instance of the Connection class.

public Connection(string);

See Also

Connection Class | TDevFramework Namespace


Connection Constructor ()

Initializes a new instance of the Connection class.

protected Connection();

See Also

Connection Class | TDevFramework Namespace | Connection Constructor Overload List


Connection Constructor (String)

Initializes a new instance of the Connection class.

public Connection(
string connectionString
);

Parameters

connectionString
String that contains the connection string for the database.

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

See Also

Connection Class | TDevFramework Namespace | Connection Constructor Overload List


Connection Fields

The fields of the Connection class are listed below. For a complete list of Connection class members, see the Connection Members topic.

Protected Instance Fields

_connectionString | Used to specify the connectin string.
_isManualTransaction | Used to see whether transaction is manually started or not.
_isOpen | Used to see whether connectin is open or close.

See Also

Connection Class | TDevFramework Namespace


Connection._connectionString Field

Used to specify the connectin string.

protected string _connectionString;

See Also

Connection Class | TDevFramework Namespace


Connection._isManualTransaction Field

Used to see whether transaction is manually started or not.

protected bool _isManualTransaction;

See Also

Connection Class | TDevFramework Namespace


Connection._isOpen Field

Used to see whether connectin is open or close.

protected bool _isOpen;

See Also

Connection Class | TDevFramework Namespace


Connection Properties

The properties of the Connection class are listed below. For a complete list of Connection class members, see the Connection Members topic.

Public Instance Properties

Transaction Gets the current transaction.

See Also

Connection Class | TDevFramework Namespace


Transaction Property

TierDeveloper Framework API

Connection.Transaction Property

Gets the current transaction.

public abstract object Transaction {get;}

See Also

Connection Class | TDevFramework Namespace


Connection Methods

The methods of the Connection class are listed below. For a complete list of Connection class members, see the Connection Members topic.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
CloseConnection | This method closes the currently opened connection and sets the IsOpen flag to false.
CreateCommand | This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.
Equals (inherited from Object) |
getConnection | This method returns the .NET Data Provider specific Connection object i.e. OleDbConnection, OracleConnection or SqlConnection.
getConnectionString | Gets the connection string.
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IsManualTransaction | Determines whether transaction is manual or not.
IsOpen | Determines whether connection is open or not and return true or false accordingly.
OpenConnection | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
SetAbort | This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.
SetManualTransaction | This method sets the transaction as manual.
SetStatus | This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
setOpen | This method sets the _isOpen property to true or false.

See Also

Connection Class | TDevFramework Namespace


BeginTransaction Method

TierDeveloper Framework API

Connection.BeginTransaction Method

Starts the transaction.

Overload List

Starts the transaction.

public abstract object BeginTransaction();

Starts the transaction.

public abstract object BeginTransaction(IsolationLevel);

See Also

Connection Class | TDevFramework Namespace


Connection.BeginTransaction Method ()

Starts the transaction.

public abstract object BeginTransaction();

Return Value

object

See Also

Connection Class | TDevFramework Namespace | Connection.BeginTransaction Overload List


Connection.BeginTransaction Method (IsolationLevel)

Starts the transaction.

public abstract object BeginTransaction(
IsolationLevel isolationLevel
);

Parameters

isolationLevel
The IsolationLevel values are used by a .NET Framework data provider when performing a transaction.

Return Value

object

See Also

Connection Class | TDevFramework Namespace | Connection.BeginTransaction Overload List


Connection.CloseConnection Method

This method closes the currently opened connection and sets the IsOpen flag to false.

public abstract void CloseConnection();

See Also

Connection Class | TDevFramework Namespace


Connection.CreateCommand Method

This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.

public abstract Command CreateCommand(
string commandString,
bool isStoredProc
);

Parameters

commandString
isStoredProc
bool value

Return Value

Command object

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

See Also

Connection Class | TDevFramework Namespace


Connection.getConnection Method

This method returns the .NET Data Provider specific Connection object i.e. OleDbConnection, OracleConnection or SqlConnection.

public abstract object getConnection();

Return Value

OleDbConnection, OracleConnection or SqlConnection

See Also

Connection Class | TDevFramework Namespace


Connection.getConnectionString Method

Gets the connection string.

public string getConnectionString();

Return Value

Returns a connection string

See Also

Connection Class | TDevFramework Namespace


Connection.IsManualTransaction Method

Determines whether transaction is manual or not.

public bool IsManualTransaction();

Return Value

Returns either true or false

See Also

Connection Class | TDevFramework Namespace


Connection.IsOpen Method

Determines whether connection is open or not and return true or false accordingly.

public bool IsOpen();

Return Value

Returns either true or false

See Also

Connection Class | TDevFramework Namespace


OpenConnection Method

TierDeveloper Framework API

Connection.OpenConnection Method

Opens a database connection.

Overload List

Opens a database connection.

public object OpenConnection();

Opens a database connection with the property settings specified by the ConnectionString

public abstract object OpenConnection(string);

See Also

Connection Class | TDevFramework Namespace


Connection.OpenConnection Method ()

Opens a database connection.

public object OpenConnection();

See Also

Connection Class | TDevFramework Namespace | Connection.OpenConnection Overload List


Connection.OpenConnection Method (String)

Opens a database connection with the property settings specified by the ConnectionString

public abstract object OpenConnection(
string connectionString
);

Parameters

connectionString
String that contains the connection string for the database.

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

See Also

Connection Class | TDevFramework Namespace | Connection.OpenConnection Overload List


Connection.SetAbort Method

This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.

public abstract void SetAbort();

See Also

Connection Class | TDevFramework Namespace


Connection.SetComplete Method

This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.

public abstract void SetComplete();

See Also

Connection Class | TDevFramework Namespace


Connection.SetManualTransaction Method

This method sets the transaction as manual.

public void SetManualTransaction(
bool isManualTransaction
);

Parameters

isManualTransaction
true or false, tells whether transaction is manual or not

See Also

Connection Class | TDevFramework Namespace


Connection.setOpen Method

This method sets the _isOpen property to true or false.

protected void setOpen(
bool isOpen
);

Parameters

isOpen
bool parameter

See Also

Connection Class | TDevFramework Namespace


Connection.SetStatus Method

This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.

public abstract void SetStatus(
EStatus eStatus
);

Parameters

eStatus
It represents the status for a transaction that causes the transaction to complete or abort.

See Also

Connection Class | TDevFramework Namespace


DbObject Class

This class serves as the base class for the ComponentFactory class and provides data-access specific operations that are based on ADO.NET framework.

For a list of all members of this type, see DbObject Members.

System.Object
TDevFramework.DbObject

public abstract class DbObject

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

DbObject class serves as the base class for the ComponentFactory class and provides data-access specific operations that are based on ADO.NET framework. It includes construction and manipulation of ADO.NET framework data classes that consists of Connection, Command, DataAdaptor, DataReader and DataSet. The purpose of the DbObject class is to encapsulate the construction and management functionality for the ADO.NET classes at a single point and to avoid the code duplication across components. Additionally it abstracts away the commonly used construction code so that the ComponentFactory implementation becomes simple to read and maintain.

Example

[C#]

// This is an example for DbObject class. First of all you have
// to inherit this abstract class to access its memebers.

public class Test : DbObject
{

    // Test class constructor
    public Test() : base("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
        TestDemo();
    }

    public void TestDemo()
    {
        Test test = new Test();
        // OpenConnection is a member function of DbObject class.
        test.OpenConnection("Data Source=localhost;Database=tdevstore;User Id=sa;Password=;", TDevFramework.EDBProvider.SQLCLIENT)");

        // Apply your own logic here.

           // Close the connection.
        test.CloseConnection();
    }

}

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

DbObject Members | TDevFramework Namespace


DbObject Members

DbObject overview

Public Instance Properties

DBProvider This property specifies the .NET Data Provider associated with this Object. This is an editable property and let the user retrieve and set the value for .NET Data Provider.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around DataReader.GetBytes method and gets the value of the specified column as a byte array.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls DataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of DataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of DataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getIDNTValue | This method takes input parameter as a column name and return its value.
GetLastStatus | Gets the last transaction status.
getParameterValue | This is wrapper method around TDevFramework Command object getParameterValue method.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls DataAdapter Fill method to populate the DataSet object.
ProcessDataSet | Overloaded. This feature is not included in TierDeveloper 5.0
Read | This is a wrapper method and makes call to the Read method of DataReader object associated with the specific Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReleaseCommand | This method is a wrapper arround CloseConnection method and closes any open connection associated with DbObject.
ReleaseReader | This method release the DataReader object associated with the Command object.
ToString (inherited from Object) |

Protected Instance Constructors

DbObject Overloaded. Initializes a new instance of the DbObject class.

Protected Instance Methods

AddCmdParameter | Overloaded. This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.
CloseConnection | This method close any open connection associated with DbObject.
CreateCommand | This is a wrapper method around Connection object CreateCommand method.
Finalize (inherited from Object) |
getConnection | This method returns the .NET Data Provider specific Connection object i.e. OleDbConnection, OracleConnection or SqlConnection.
getConnectionString | This method returns the connection string associated with this DbObject object.
GetResString | This method provides access to culture-specific resources at runtime and gets the value of the System.String resource localized for the specific culture.
IsNull | This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
MemberwiseClone (inherited from Object) |
OpenConnection | Opens a database connection with the property settings specified by the ConnectionString.
Prepare | This is wrapper method around Command object Prepare method and constructs the.NET Data Provider specific Command object.
PrepareCommand | This method creates a new .NET Data Provider specific Command object if it not created.
SetAbort | This is wrapper method around Connection object setAbort method and is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This is wrapper method around Connection object setComplete method and is called as part of the Transaction and makes call to ContextUtil. SetComplete () method.
setConnectionString | This method sets the connection string associated with this DbObject object.
SetStatus | This is a wrapper method around Connection object and causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.

See Also

DbObject Class | TDevFramework Namespace


DbObject Constructor

Overloaded. Initializes a new instance of DbObject class.

Overload List

Overloaded. Initializes a new instance of DbObject class.

protected DbObject();

protected DbObject(object,EDBProvider);

protected DbObject(string,EDBProvider);

protected DbObject(Connection);

See Also

DbObject Class | TDevFramework Namespace


DbObject Constructor ()

Overloaded. Initializes a new instance of DbObject class.

protected DbObject();

See Also

DbObject Class | TDevFramework Namespace | DbObject Constructor Overload List


DbObject Constructor (String, EDBProvider)

protected DbObject(
string connectionString,
EDBProvider eDbProvider
);

Parameters

connectionString
String that contains the connection string for the database.
eDbProvider
It is used to specify the .NET Data Provider type during the creation of the ComponentFactory class that calls the base class i.e. DbObject constructor and passes on of the supported .NET Data Provider values. The DbObject class constructs the specific objects for Command and Connection classes based on this value.

See Also

DbObject Class | TDevFramework Namespace | DbObject Constructor Overload List


DbObject Constructor (Object, EDBProvider)

protected DbObject(
object connection,
EDBProvider eDbProvider
);

Parameters

connection
object of Connection class.
eDbProvider
It is used to specify the .NET Data Provider type during the creation of the ComponentFactory class that calls the base class i.e. DbObject constructor and passes on of the supported .NET Data Provider values. The DbObject class constructs the specific objects for Command and Connection classes based on this value.

See Also

DbObject Class | TDevFramework Namespace | DbObject Constructor Overload List


DbObject Constructor (Connection)

protected DbObject(
Connection connection
);

Parameters

connection
object of Connection class.

See Also

DbObject Class | TDevFramework Namespace | DbObject Constructor Overload List


DbObject Properties

The properties of the DbObject class are listed below. For a complete list of DbObject class members, see the DbObject Members topic.

Public Instance Properties

DBProvider This property specifies the .NET Data Provider associated with this Object. This is an editable property and let the user retrieve and set the value for .NET Data Provider.

See Also

DbObject Class | TDevFramework Namespace


DBProvider Property

TierDeveloper Framework API

DbObject.DBProvider Property

This property specifies the .NET Data Provider associated with this Object. This is an editable property and let the user retrieve and set the value for .NET Data Provider.

public EDBProvider DBProvider {get; set;}

See Also

DbObject Class | TDevFramework Namespace


DbObject Methods

The methods of the DbObject class are listed below. For a complete list of DbObject class members, see the DbObject Members topic.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around DataReader.GetBytes method and gets the value of the specified column as a byte array.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls DataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of DataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of DataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getIDNTValue | This method takes input parameter as a column name and return its value.
GetLastStatus | Gets the last transaction status.
getParameterValue | This is wrapper method around TDevFramework Command object getParameterValue method.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls DataAdapter Fill method to populate the DataSet object.
ProcessDataSet | Overloaded. This feature is not included in TierDeveloper 5.0
Read | This is a wrapper method and makes call to the Read method of DataReader object associated with the specific Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReleaseCommand | This method is a wrapper arround CloseConnection method and closes any open connection associated with DbObject.
ReleaseReader | This method release the DataReader object associated with the Command object.
ToString (inherited from Object) |

Protected Instance Methods

AddCmdParameter | Overloaded. This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.
CloseConnection | This method close any open connection associated with DbObject.
CreateCommand | This is a wrapper method around Connection object CreateCommand method.
Finalize (inherited from Object) |
getConnection | This method returns the .NET Data Provider specific Connection object i.e. OleDbConnection, OracleConnection or SqlConnection.
getConnectionString | This method returns the connection string associated with this DbObject object.
GetResString | This method provides access to culture-specific resources at runtime and gets the value of the System.String resource localized for the specific culture.
IsNull | This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
MemberwiseClone (inherited from Object) |
OpenConnection | Opens a database connection with the property settings specified by the ConnectionString.
Prepare | This is wrapper method around Command object Prepare method and constructs the.NET Data Provider specific Command object.
PrepareCommand | This method creates a new .NET Data Provider specific Command object if it not created.
SetAbort | This is wrapper method around Connection object setAbort method and is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This is wrapper method around Connection object setComplete method and is called as part of the Transaction and makes call to ContextUtil. SetComplete () method.
setConnectionString | This method sets the connection string associated with this DbObject object.
SetStatus | This is a wrapper method around Connection object and causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.

See Also

DbObject Class | TDevFramework Namespace


AddCmdParameter Method

TierDeveloper Framework API

DbObject.AddCmdParameter Method

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

Overload List

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(string,EDataType,object,EParamDirection);

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(string,EDataType,object,EParamDirection,bool);

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(string,EDataType,object,EParamDirection,int);

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(string,EDataType,object,EParamDirection,int,bool);

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(string,EDataType,EParamDirection);

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(string,EDataType,EParamDirection,int);

See Also

DbObject Class | TDevFramework Namespace


DbObject.AddCmdParameter Method (String, EDataType, Object, EParamDirection)

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction
);

Parameters

name
Name of the parameter
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Example

[C#]

//  The following example will demonstrate the use of AddCmdParameter method.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();

            // Adding command parameter here
            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput);
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput);
            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(test.getValue("course_id"));
            }
            test.ReleaseReader();

            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace | DbObject.AddCmdParameter Overload List


DbObject.AddCmdParameter Method (String, EDataType, Object, EParamDirection, Boolean)

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
bool bNull
);

Parameters

name
Name of the parameter
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
bNull
Determine whether value is null or not.

Example

[C#]

//  The following example will demonstrate the use of AddCmdParameter method.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();

            // Adding command parameter here
            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(test.getValue("course_id"));
            }
            test.ReleaseReader();

            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace | DbObject.AddCmdParameter Overload List


DbObject.AddCmdParameter Method (String, EDataType, Object, EParamDirection, Int32)

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size
);

Parameters

name
Name of the parameter
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

Example

[C#]

//  The following example will demonstrate the use of AddCmdParameter method.
public class Test : DbObject
{
    private const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();

            // Adding command parameter here
            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput,size);
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput,size);
            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(test.getValue("course_id"));
            }
            test.ReleaseReader();

            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace | DbObject.AddCmdParameter Overload List


DbObject.AddCmdParameter Method (String, EDataType, Object, EParamDirection, Int32, Boolean)

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size,
bool bNull
);

Parameters

name
Name of the parameter
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size
bNull
Determine whether value is null or not.

Example

[C#]

//  The following example will demonstrate the use of AddCmdParameter method.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();

            // Adding command parameter here
            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, size ,objInfo.IsNull("course_name"));
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, size ,objInfo.IsNull("credit_hours"));
            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(test.getValue("course_id"));
            }
            test.ReleaseReader();

            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace | DbObject.AddCmdParameter Overload List


DbObject.AddCmdParameter Method (String, EDataType, EParamDirection)

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(
string name,
EDataType eType,
EParamDirection direction
);

Parameters

name
Name of the parameter.
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Example

[C#]

//  The following example will demonstrate the use of AddCmdParameter method.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();

            // Adding command parameter here
            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, TDevFramework.EParamDirection.eInput);
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt, TDevFramework.EParamDirection.eInput);
            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(test.getValue("course_id"));
            }
            test.ReleaseReader();

            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace | DbObject.AddCmdParameter Overload List


DbObject.AddCmdParameter Method (String, EDataType, EParamDirection, Int32)

This is wrapper method around Command object AddParameter method and has multiple overload definitions that correspond to the different parameters variations for defining numeric parameters with size and default value.

protected void AddCmdParameter(
string name,
EDataType eType,
EParamDirection direction,
int size
);

Parameters

name
Name of the parameter
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

Example

[C#]

//  The following example will demonstrate the use of AddCmdParameter method.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();

            // Adding command parameter here
            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, TDevFramework.EParamDirection.eInput);
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt , TDevFramework.EParamDirection.eInput, size);
            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(test.getValue("course_id"));
            }
            test.ReleaseReader();

            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace | DbObject.AddCmdParameter Overload List


BeginTransaction Method

TierDeveloper Framework API

DbObject.BeginTransaction Method

Starts the transaction.

Overload List

Starts the transaction.

public void BeginTransaction();

public void BeginTransaction(IsolationLevel);

See Also

DbObject Class | TDevFramework Namespace


DbObject.BeginTransaction Method ()

Starts the transaction.

public void BeginTransaction();

Example

[C#]

//  The following example will demonstrate the use of BeginTransaction function.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public Int32 FindByStudentCount( Int32 n32prmstudent_id)
    {
        const String FindByStudent_SQL = @"SELECT t1.course_id course_id, t1.course_name course_name,t1.credit_hours credit_hours FROM Course t1 INNER JOIN  CourseTaken a1 ON t1.course_id = a1.course_id WHERE (a1.student_id = ?)";

        Test test = new Test();
        Int32 recordCount = 0;
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(FindByStudentCount_SQL, false);
            test.Prepare(FindByStudentCount_SQL, false);

            test.BeginTransaction();
            test.AddCmdParameter("@prmstudent_id", TDevFramework.EDataType.eInt, n32prmstudent_id, EParamDirection.eInput);
            recordCount = Convert.ToInt32(test.ExecuteScalar());
            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
        return recordCount;
    }
}

See Also

DbObject Class | TDevFramework Namespace | DbObject.BeginTransaction Overload List


DbObject.BeginTransaction Method (IsolationLevel)

public void BeginTransaction(
IsolationLevel isolationLevel
);

Parameters

isolationLevel
The IsolationLevel values are used by a .NET Framework data provider when performing a transaction.

Remarks

See Also

DbObject Class | TDevFramework Namespace | DbObject.BeginTransaction Overload List


DbObject.CloseConnection Method

This method close any open connection associated with DbObject.

protected virtual void CloseConnection();

Example

[C#]
//  The following example will demonstrate the use of CloseConnection method.

public class Course: DbObject()
{
    // Creates a connection object in the base class
    public Course(): base("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public static void Main()
    {
        Course obj= new Course();

        // get connectionString here
        string connectionString = obj.getConnectionString();
        obj.OpenConnection(connectionString);

        // Apply your own logic here

        obj.CloseConnection();

    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.CreateCommand Method

This is a wrapper method around Connection object CreateCommand method.

protected Command CreateCommand(
string commandString,
bool isStoredProc
);

Parameters

commandString
String that contains the Sql command.
isStoredProc
bool parameter.

Return Value

Command object.

Example

[C#]

//  The following example will demonstrate the use of CreateCommand method.
public class Test : DbObject
{
    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void useCreateComand()
    {
        Test test = new Test();
        string mySelectQuery = "SELECT EmpNo, DeptNo FROM Emp";
        test.OpenConnection();

        // Now create a command object
        Command myCommand = test.CreateCommand(mySelectQuery,false);
        test.Prepare(mySelectQuery, false);
        test.ExecuteReader();
        while(test.Read())
        {
            // Apply your own logic here.
        }

        test.ReleaseReader();
        test.ReleaseCommand();
    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.ExecuteNonQuery Method

Executes a Transact-SQL statement against the connection and returns the number of rows affected.

public int ExecuteNonQuery();

Return Value

number of rows affected

Example

[C#]

//  The following example will demonstrate the use of ExecuteNonQuery function.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Delete(Course objInfo, int nDepth)
    {
        const String STD_DELETE_SQL = @"DELETE FROM Course  WHERE  course_id = ?";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_DELETE_SQL, USE_STORE_PROC);
            test.Prepare(STD_DELETE_SQL, USE_STORE_PROC);
            test.BeginTransaction();

            test.AddCmdParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

            // ExecuteNonQuery  method
            test.ExecuteNonQuery();

            test.ReleaseReader();
            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }

    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.ExecuteReader Method

Executes commands that return rows.

public void ExecuteReader();

Example

[C#]

//  The following example will demonstrate the use of ExecuteReader function.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();

            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
            }
            test.ReleaseReader();
            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.ExecuteScalar Method

Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.

public object ExecuteScalar();

Return Value

object.i.e returns the first column of the first row.

Example

[C#]

//  The following example will demonstrate the use of ExecuteScalar function.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public Int32 FindByStudentCount( Int32 n32prmstudent_id)
    {
        const String FindByStudent_SQL = @"SELECT t1.course_id course_id, t1.course_name course_name,t1.credit_hours credit_hours FROM Course t1 INNER JOIN  CourseTaken a1 ON t1.course_id = a1.course_id WHERE (a1.student_id = ?)";

        Test test = new Test();
        Int32 recordCount = 0;
        try
        {
            objInfo.ValidateRequiredFields();
            test.Prepare(FindByStudentCount_SQL, false);
            test.BeginTransaction();
            test.AddCmdParameter("@prmstudent_id", TDevFramework.EDataType.eInt, n32prmstudent_id, EParamDirection.eInput);

            recordCount = Convert.ToInt32(ExecuteScalar());
            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
        return recordCount;
    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.getBytes Method

This method is a wrapper around DataReader.GetBytes method and gets the value of the specified column as a byte array.

public byte[] getBytes(
string columnName
);

Parameters

columnName

Return Value

Returns array of bytes.

See Also

DbObject Class | TDevFramework Namespace


DbObject.getByteSize Method

This method returns total number of bytes in the target binary attribute.

public object getByteSize(
string columnName
);

Parameters

columnName

Return Value

long.

See Also

DbObject Class | TDevFramework Namespace


DbObject.getConnection Method

This method returns the .NET Data Provider specific Connection object i.e. OleDbConnection, OracleConnection or SqlConnection.

protected Connection getConnection();

Return Value

Returns OleDbConnection, OracleConnection or SqlConnection.

Example

[C#]
//  The following will demonstrate the use of getConnection method.

public class Course: DbObject();
{
    public Course(): base("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public static void Main()
    {
        Course obj= new Course();

        // get the connection object here.
        Connection connection = obj.getConnection();

        // Apply your own logic here

    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.getConnectionString Method

This method returns the connection string associated with this DbObject object.

protected string getConnectionString();

Return Value

Returns connectionString.

Example

[C#]

//  The following example will demonstrate the use of CreateCommand function.
public class Test : DbObject
{
    // Test class constructor. Also see overloaded constructors
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public string getConnString()
    {
        Test test = new Test();
        // Set the new connection String
        string connString = test.getConnectionString();
        // Apply your own logic here.

        return connString;
    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.GetDataSet Method

This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls DataAdapter Fill method to populate the DataSet object.

public DataSet GetDataSet(
string tableName
);

Return Value

DataSet object.

See Also

DbObject Class | TDevFramework Namespace


DbObject.getFieldCount Method

This is wrapper around FieldCount property of DataReader and returns number of columns in the current row.

public int getFieldCount();

Return Value

int

See Also

DbObject Class | TDevFramework Namespace


DbObject.getFieldName Method

This is wrapper around GetName method of DataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.

public string getFieldName(
int index
);

Parameters

index

Return Value

string

See Also

DbObject Class | TDevFramework Namespace


DbObject.getIDNTValue Method

This method takes input parameter as a column name and return its value.

public object getIDNTValue(
string columnName
);

Parameters

columnName
Name of the column.

Return Value

object i.e value of column.

See Also

DbObject Class | TDevFramework Namespace


DbObject.GetLastStatus Method

Gets the last transaction status.

public EStatus GetLastStatus();

Return Value

EStatus i.e Status of transaction eSuccess or eFail.

See Also

DbObject Class | TDevFramework Namespace


DbObject.getParameterValue Method

This is wrapper method around TDevFramework Command object getParameterValue method.

public object getParameterValue(
string parameterName
);

Parameters

parameterName
Name of parameter.

Return Value

See Also

DbObject Class | TDevFramework Namespace


DbObject.GetResString Method

This method provides access to culture-specific resources at runtime and gets the value of the System.String resource localized for the specific culture.

protected string GetResString(
string resKey
);

Parameters

resKey
string parameter of resource key.

Return Value

string

See Also

DbObject Class | TDevFramework Namespace


getValue Method

TierDeveloper Framework API

DbObject.getValue Method

This method returns the value of the specific column in the current row.

Overload List

This method returns the value of the specific column in the current row.

public object getValue(int);

This method returns the value of the specific column in the current row.

public object getValue(string);

See Also

DbObject Class | TDevFramework Namespace


DbObject.getValue Method (Int32)

This method returns the value of the specific column in the current row.

public object getValue(
int colIndex
);

Parameters

colIndex
Specify index of the column.

Return Value

Returns an object.i.e Value of the specific column.

Example

// The following example will show the use of getValue function.

private void FillPersistentObject(Customer objInfo,int index)
{
    if (!IsNull("company"))
        objInfo.company = Convert.ToString(getValue(index));

}

See Also

DbObject Class | TDevFramework Namespace | DbObject.getValue Overload List


DbObject.getValue Method (String)

This method returns the value of the specific column in the current row.

public object getValue(
string columnName
);

Parameters

columnName
Name of column of a table

Return Value

Returns an object.i.e Value of the specific column.

Example

// The following example will show the use of getValue function.

private void FillPersistentObject(Customer objInfo)
{
    if (!IsNull("company"))
        objInfo.company = Convert.ToString(getValue("company"));

}

See Also

DbObject Class | TDevFramework Namespace | DbObject.getValue Overload List


DbObject.IsNull Method

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

protected bool IsNull(
string columnName
);

Parameters

columnName
Name of the column of a specific table.

Return Value

Returns bool value either true or false.

Example

// The following example will show the use of IsNull function.

private void FillPersistentObject(Customer objInfo)
{
    if (!IsNull("company"))
        objInfo.company = Convert.ToString(getValue("company"));

}

See Also

DbObject Class | TDevFramework Namespace


DbObject.OpenConnection Method

Opens a database connection with the property settings specified by the ConnectionString.

protected virtual object OpenConnection(
string connectionString
);

Parameters

connectionString
String that contains the connection string for the database.

Return Value

Connection object.

Example

[C#]
//  The following example will demonstrate the use of OpenConnection method.

public class Course: DbObject()
{
    // Creates a connection object in the base class
    public Course(): base("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public static void Main()
    {
        Course obj= new Course();

        // get connectionString here
        string connectionString = obj.getConnectionString();
        obj.OpenConnection(connectionString);

        // Apply your own logic here

        obj.CloseConnection();
    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.PopulateDataSet Method

This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls DataAdapter Fill method to populate the DataSet object.

public void PopulateDataSet(
string dataTableName,
ref DataSet dataSet
);

Parameters

dataTableName
Name of the table.
dataSet
Pass DataSet object by reference.

See Also

DbObject Class | TDevFramework Namespace


DbObject.Prepare Method

This is wrapper method around Command object Prepare method and constructs the.NET Data Provider specific Command object.

protected void Prepare(
string sqlCmd,
bool isStoredProc
);

Parameters

sqlCmd
string contains the sql command.
isStoredProc
bool parameter.

Example

[C#]

//  The following example will demonstrate the use of CreateCommand method.
public class Test : DbObject
{
    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void useCreateComand()
    {
        Test test = new Test();
        string mySelectQuery = "SELECT EmpNo, DeptNo FROM Emp";
        test.OpenConnection();

        // Now create a command object
        Command myCommand = test.CreateCommand(mySelectQuery,false);

        test.Prepare(mySelectQuery, false);
        test.ExecuteReader();

        while(test.Read())
        {
            // Apply your own logic here.
        }

        test.ReleaseReader();
        test.ReleaseCommand();
    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.PrepareCommand Method

This method creates a new .NET Data Provider specific Command object if it not created.

protected void PrepareCommand(
string sqlCmd,
bool isStoredProc
);

Parameters

sqlCmd
Contains the sql command.
isStoredProc
bool parameter.

Example

[C#]

//  The following example will demonstrate the use of CreateCommand method.
public class Test : DbObject
{
    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void useCreateComand()
    {
        Test test = new Test();
        string mySelectQuery = "SELECT EmpNo, DeptNo FROM Emp";
        test.OpenConnection();

        // Now create a command object
        Command myCommand = test.PrepareCommand(mySelectQuery,false);
        test.ExecuteReader();
        while(test.Read())
        {
            // Apply your own logic here.
        }

        test.ReleaseReader();
        test.ReleaseCommand();
    }
}

See Also

DbObject Class | TDevFramework Namespace


ProcessDataSet Method

TierDeveloper Framework API

DbObject.ProcessDataSet Method

This feature is not included in TierDeveloper 5.0

Overload List

This feature is not included in TierDeveloper 5.0

public void ProcessDataSet(DataSet);

This feature is not included in TierDeveloper 5.0

public void ProcessDataSet(string,DataSet);

See Also

DbObject Class | TDevFramework Namespace


DbObject.ProcessDataSet Method (DataSet)

This feature is not included in TierDeveloper 5.0

public void ProcessDataSet(
DataSet dataSet
);

Parameters

dataSet
Object of DataSet.

See Also

DbObject Class | TDevFramework Namespace | DbObject.ProcessDataSet Overload List


DbObject.ProcessDataSet Method (String, DataSet)

This feature is not included in TierDeveloper 5.0

public void ProcessDataSet(
string dataTableName,
DataSet dataSet
);

Parameters

dataTableName
dataSet
Object of DataSet.

See Also

DbObject Class | TDevFramework Namespace | DbObject.ProcessDataSet Overload List


DbObject.Read Method

This is a wrapper method and makes call to the Read method of DataReader object associated with the specific Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.

public bool Read();

Return Value

Returns bool value either true or false.

Example

[C#]

//  The following example will demonstrate the use of Read function.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();
            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
            }
            test.ReleaseReader();
            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.ReleaseCommand Method

This method is a wrapper arround CloseConnection method and closes any open connection associated with DbObject.

public void ReleaseCommand();

See Also

DbObject Class | TDevFramework Namespace


DbObject.ReleaseReader Method

This method release the DataReader object associated with the Command object.

public void ReleaseReader();

See Also

DbObject Class | TDevFramework Namespace


DbObject.SetAbort Method

This is wrapper method around Connection object setAbort method and is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.

protected void SetAbort();

See Also

DbObject Class | TDevFramework Namespace


DbObject.SetComplete Method

This is wrapper method around Connection object setComplete method and is called as part of the Transaction and makes call to ContextUtil. SetComplete () method.

protected void SetComplete();

See Also

DbObject Class | TDevFramework Namespace


DbObject.setConnectionString Method

This method sets the connection string associated with this DbObject object.

protected void setConnectionString(
string connectionString
);

Parameters

connectionString
String that contains the connection string for the database.

Example

[C#]

//  The following example will demonstrate the use of CreateCommand function.
public class Test : DbObject
{
    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void setConnString()
    {
        Test test = new Test();

        // Set the new connection String
        test.setConnectionstring("Data Source=localhost;Database=pubs;User Id=sa;Password=;")
        test.OpenConnection();
        // Apply your own logic here.
        test.CloseConnection();
    }
}

See Also

DbObject Class | TDevFramework Namespace


DbObject.SetStatus Method

This is a wrapper method around Connection object and causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.

protected void SetStatus(
EStatus eStatus
);

Parameters

eStatus
EStatus parameter contains value either eFail or eSuccess.

Example

[C#]

//  The following example will demonstrate the use of SetStatus function.
public class Test : DbObject
{

    // Test class constructor
    public Test(): base ("Provider=SQLOLEDB;Data Source=localhost;Database=northwind;User Id=sa;Password=;", TDevFramework.EDBProvider.OLEDB)
    {
    }

    public void Insert(Course objInfo)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
        const bool USE_STORE_PROC = false;

        Test test = new Test();
        try
        {
            objInfo.ValidateRequiredFields();
            test.CreateCommand(STD_INSERT_SQL,USE_STORE_PROC);
            test.Prepare(STD_INSERT_SQL, USE_STORE_PROC);
            test.BeginTransaction();
            test.AddCmdParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
            test.AddCmdParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
            test.ExecuteReader();

            if (test.Read ())
            {
                if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(test.getValue("course_id"));
            }
            test.ReleaseReader();

            // Set status for transaction
            test.SetStatus(EStatus.eSuccess);
            test.ReleaseCommand();
        }
        catch (Exception e)
        {
            test.SetStatus(EStatus.eFail);
            test.ReleaseCommand();
        }
    }
}

See Also

DbObject Class | TDevFramework Namespace


EDataType Enumeration

It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute. The list of available data types is shown below. Each data type corresponds to a .NET data type.

public enum EDataType

Members

Member Name | Description
eBigInt | A 64-bit signed integer (DBTYPE_I8). This maps to Int64.
eBinary | A stream of binary data (DBTYPE_BYTES). This maps to an Array of type Byte.
eBoolean | A Boolean value (DBTYPE_BOOL). This maps to Boolean.
eBSTR | A null-terminated character string of Unicode characters (DBTYPE_BSTR). This maps to String.
eChar | A character string (DBTYPE_STR). This maps to String.
eCurrency | A currency value ranging from -263 (or -922,337,203,685,477.5808) to 2 63 -1 (or +922,337,203,685,477.5807) with an accuracy to a ten-thousandth of a currency unit (DBTYPE_CY). This maps to Decimal.
eDate | Date data, stored as a double (DBTYPE_DATE). The whole portion is the number of days since December 30, 1899, while the fractional portion is a fraction of a day. This maps to DateTime.
eDBDate | Date data in the format yyyymmdd (DBTYPE_DBDATE). This maps to DateTime.
eDBTime | Time data in the format hhmmss (DBTYPE_DBTIME). This maps to TimeSpan.
eDBTimeStamp | Data and time data in the format yyyymmddhhmmss (DBTYPE_DBTIMESTAMP). This maps to DateTime.
eDecimal | A fixed precision and scale numeric value between -1038 -1 and 10 38 -1 (DBTYPE_DECIMAL). This maps to Decimal.
eDouble | A floating point number within the range of -1.79E +308 through 1.79E +308 (DBTYPE_R8). This maps to Double.
eGuid |
eInteger | A 32-bit signed integer (DBTYPE_I4). This maps to Int32.
eLongVarBinary | A long binary value (OleDbParameter only). This maps to an Array of type Byte.
eLongVarChar | A long string value (OleDbParameter only). This maps to String.
eLongVarWChar | A long null-terminated Unicode string value (OleDbParameter only). This maps to String.
eNumeric | An exact numeric value with a fixed precision and scale (DBTYPE_NUMERIC). This maps to Decimal.
eSingle | A floating point number within the range of -3.40E +38 through 3.40E +38 (DBTYPE_R4). This maps to Single.
eSmallInt | A 16-bit signed integer (DBTYPE_I2). This maps to Int16.
eTinyInt | A 8-bit signed integer (DBTYPE_I1). This maps to SByte.
eUnsignedBigInt | A 64-bit unsigned integer (DBTYPE_UI8). This maps to UInt64.
eUnsignedInt | A 32-bit unsigned integer (DBTYPE_UI4). This maps to UInt32.
eUnsignedSmallInt | A 16-bit unsigned integer (DBTYPE_UI2). This maps to UInt16.
eUnsignedTinyInt | A 8-bit unsigned integer (DBTYPE_UI1). This maps to Byte.
eVarBinary | A variable-length stream of binary data (OleDbParameter only). This maps to an Array of type Byte.
eVarChar | A variable-length stream of non-Unicode characters (OleDbParameter only). This maps to String.
eVariant | A special data type that can contain numeric, string, binary, or date data, as well as the special values Empty and Null (DBTYPE_VARIANT). This type is assumed if no other is specified. This maps to Object.
eVarNumeric | A variable-length numeric value (OleDbParameter only). This maps to Decimal.
eVarWChar | A variable-length, null-terminated stream of Unicode characters (OleDbParameter only). This maps to String.
eWChar | A null-terminated stream of Unicode characters (DBTYPE_WSTR). This maps to String.
eCursor |

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

TDevFramework Namespace


EDBProvider Enumeration

It is used to specify the .NET Data Provider type during the creation of the ComponentFactory class that calls the base class i.e. DbObject constructor and passes on of the supported .NET Data Provider values. The DbObject class constructs the specific objects for Command and Connection classes based on this value.

public enum EDBProvider

Members

Member Name | Description
OLEDB | OLEDB = 1
SQLCLIENT | SQLCLIENT = 2
ORACLECLIENT | ORACLECLIENT = 3

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

TDevFramework Namespace


EParamDirection Enumeration

It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

public enum EParamDirection

Members

Member Name | Description
eInput | The parameter is an input parameter.
eOutput | The parameter is an output parameter.
eInputOutput | The parameter is capable of both input and output.
eReturnValue | The parameter represents a return value from an operation such as a stored procedure, built-in function, or user-defined function.

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

TDevFramework Namespace


EStatus Enumeration

It represents the status for a transaction and is used in SetStatus method of TDevFramework Connection class that causes the transaction to complete or abort based on this value.

public enum EStatus

Members

Member Name | Description
eFail | The parameter is for failover Transaction.
eSuccess | The parameter is for successful Transaction.

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

TDevFramework Namespace


OleDbCommand Class

This class is derived from TDevFramework Command class and provides the implementation for the .NET Data Provider for OLE DB. The purpose of this class is to facilitate the construction of a OleDbCommand object and its related objects that includes Parameter and DataSet.

For a list of all members of this type, see OleDbCommand Members.

System.Object
TDevFramework.Command
TDevFramework.OleDbCommand

public class OleDbCommand : Command

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

[C#]

// The following example creates a SqlCommand using TDevFramework.OleDbCommand class.

 public void UseOleDbCommand(Course objInfo,string myConnectionString)
 {
    const String STD_UPDATE_SQL = @"UPDATE Course SET course_name = ? , credit_hours = ? WHERE course_id = ?";
    bool USE_STORE_PROC =  false;

   // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection

    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());
    myCommand.Prepare(STD_UPDATE_SQL, USE_STORE_PROC);
    myConnection.BeginTransaction();

    // Now add parameter to your myCommand object e.g.
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
    myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

    myCommand.ExecuteNonQuery();

    myConnection.SetStatus();
    // Always close your  connection.
    myConnection.CloseConnection();

  }

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

OleDbCommand Members | TDevFramework Namespace


OleDbCommand Members

OleDbCommand overview

Public Instance Constructors

OleDbCommand Constructor This is the constructor for OleDbCommand class and it constructs the OleDbCommand object based on the associated OleDbConnection object passed via connection parameter.

Public Instance Properties

Transaction Gets/Sets the current transaction.

Public Instance Methods

AddParameter | Overloaded. This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around DataReader.GetBytes method.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getParameterValue | This method returns the value for the specified parameter from the parameters collection associated with the Command object.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
IsNull | Overloaded. This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
Prepare | This method constructs the.NET Data Provider specific Command object.
PrepareNew | This method creates a new .NET Data Provider specific Command object if it not created.
ProcessDataSet | Overloaded. This feature is not included in TierDeveloper 5.0
Read | This is a wrapper method and makes call to the Read method of OleDbDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReadBytes | This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.
Release | This method closes the DataReader object associated with the Command object and disposes the Command object.
ReleaseReader | This method release the DataReader object associated with the Command object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
getParamDirection (inherited from Command) | Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet
MemberwiseClone (inherited from Object) |

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand Constructor

This is the constructor for OleDbCommand class and it constructs the OleDbCommand object based on the associated OleDbConnection object passed via connection parameter.

public OleDbCommand(
OleDbConnection connection
);

Parameters

connection
Parameter of System.Data.OleDb.OleDbConnection

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand Properties

The properties of the OleDbCommand class are listed below. For a complete list of OleDbCommand class members, see the OleDbCommand Members topic.

Public Instance Properties

Transaction Gets/Sets the current transaction.

See Also

OleDbCommand Class | TDevFramework Namespace


Transaction Property

TierDeveloper Framework API

OleDbCommand.Transaction Property

Gets/Sets the current transaction.

public override object Transaction {get; set;}

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand Methods

The methods of the OleDbCommand class are listed below. For a complete list of OleDbCommand class members, see the OleDbCommand Members topic.

Public Instance Methods

AddParameter | Overloaded. This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around DataReader.GetBytes method.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getParameterValue | This method returns the value for the specified parameter from the parameters collection associated with the Command object.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
IsNull | Overloaded. This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
Prepare | This method constructs the.NET Data Provider specific Command object.
PrepareNew | This method creates a new .NET Data Provider specific Command object if it not created.
ProcessDataSet | Overloaded. This feature is not included in TierDeveloper 5.0
Read | This is a wrapper method and makes call to the Read method of OleDbDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReadBytes | This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.
Release | This method closes the DataReader object associated with the Command object and disposes the Command object.
ReleaseReader | This method release the DataReader object associated with the Command object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
getParamDirection (inherited from Command) | Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet
MemberwiseClone (inherited from Object) |

See Also

OleDbCommand Class | TDevFramework Namespace


AddParameter Method

TierDeveloper Framework API

OleDbCommand.AddParameter Method

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

Overload List

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,bool);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,int);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,int,bool);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,EParamDirection);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,EParamDirection,int);

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.AddParameter Method (String, EDataType, Object, EParamDirection)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput );

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.AddParameter Overload List


OleDbCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Boolean)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
bool bNull
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
bNull
Determine whether value is null or not.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput , objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput , objInfo.IsNull("credit_hours"));

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.AddParameter Overload List


OleDbCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Int32)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, size);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput , size);

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.AddParameter Overload List


OleDbCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Int32, Boolean)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size,
bool bNull
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size
bNull
Determine whether value is null or not.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();

    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar,  objInfo.course_name, TDevFramework.EParamDirection.eInput, size , objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt,  objInfo.credit_hours ,TDevFramework.EParamDirection.eInput , size ,objInfo.IsNull("credit_hours"));

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.AddParameter Overload List


OleDbCommand.AddParameter Method (String, EDataType, EParamDirection)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
EParamDirection direction
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, TDevFramework.EParamDirection.eInput);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, TDevFramework.EParamDirection.eInput);

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.AddParameter Overload List


OleDbCommand.AddParameter Method (String, EDataType, EParamDirection, Int32)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
EParamDirection direction,
int size
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar,  TDevFramework.EParamDirection.eInput, size);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt,  TDevFramework.EParamDirection.eInput, size );

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.AddParameter Overload List


OleDbCommand.ExecuteNonQuery Method

Executes a Transact-SQL statement against the connection and returns the number of rows affected.

public override int ExecuteNonQuery();

Return Value

number of rows affected

Example

[C#]

// The following example demonstrates the use of ExecuteNonQuery method.

 public void UseExecuteNonQuery(Course objInfo,string myConnectionString)
 {
    const String STD_UPDATE_SQL = "spCourseUpdate"; // stored procedure
    bool USE_STORE_PROC =  true;

   // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection

    myConnection.OpenConnection();

    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_UPDATE_SQL, USE_STORE_PROC);
    myConnection.BeginTransaction();

    // Now add parameter to your myCommand object e.g.
    AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
    AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
    AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

    myCommand.ExecuteNonQuery();

    myConnection.SetStatus();
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.ExecuteReader Method

Executes commands that return rows.

public override void ExecuteReader();

Example

[C#]

//  The following example will demonstrate the use of ExecuteReader method.

    public void Load(Course objInfo ,string myConnectionString)
    {
        const String STD_LOAD_SQL = @"SELECT t2.course_id course_id , t2.course_name course_name , t2.credit_hours credit_hours FROM Course t2 WHERE t2.course_id = ?";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());
        myCommand.Prepare(STD_LOAD_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

        myCommand.ExecuteReader();

        while(myCommand.Read())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(myCommand.getValue("course_id"));
            if (!IsNull("course_name")) objInfo.course_name = Convert.ToString(myCommand.getValue("course_name"));
            if (!IsNull("credit_hours")) objInfo.credit_hours = Convert.ToInt32(myCommand.getValue("credit_hours"));
        }

        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.ExecuteScalar Method

Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.

public override object ExecuteScalar();

Return Value

object i.e. returns the first column of the first row.

Example

[C#]

//  The following example will demonstrate the use of ExecuteScalar function.

public Int32 FindByStudentCount( Int32 n32prmstudent_id, string myConnectionString)
{
    const String FindByStudent_SQL = @"SELECT t1.course_id course_id, t1.course_name course_name,t1.credit_hours credit_hours FROM Course t1 INNER JOIN  CourseTaken a1 ON t1.course_id = a1.course_id WHERE (a1.student_id = ?)";
    Int32 recordCount = 0;
    try
    {
        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

        objInfo.ValidateRequiredFields();
        myCommand.Prepare(FindByStudentCount_SQL, false);
        test.BeginTransaction();
        myCommand.AddParameter("@prmstudent_id", TDevFramework.EDataType.eInt, n32prmstudent_id, EParamDirection.eInput);

        recordCount = Convert.ToInt32(myCommand.ExecuteScalar());
        myCommand.SetStatus(EStatus.eSuccess);
        myCommand.ReleaseCommand();
    }
    catch (Exception e)
    {
        test.SetStatus(EStatus.eFail);
        test.ReleaseCommand();
    }
    return recordCount;
}

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.getBytes Method

This method is a wrapper around DataReader.GetBytes method.

public override byte[] getBytes(
string columnName
);

Parameters

columnName

Return Value

Returns array of bytes.

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.getByteSize Method

This method returns total number of bytes in the target binary attribute.

public override long getByteSize(
string columnName
);

Parameters

columnName

Return Value

long.

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.GetDataSet Method

This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.

public override DataSet GetDataSet(
string tableName
);

Return Value

DataSet object

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.getFieldCount Method

This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.

public override int getFieldCount();

Return Value

int

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.getFieldName Method

This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.

public override string getFieldName(
int index
);

Parameters

index

Return Value

string

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.getParameterValue Method

This method returns the value for the specified parameter from the parameters collection associated with the Command object.

public override object getParameterValue(
string parameterName
);

Parameters

parameterName
Specified parameter from the parameters collection associated with the Command object.

Return Value

object i.e. value for the specified parameter.

See Also

OleDbCommand Class | TDevFramework Namespace


getValue Method

TierDeveloper Framework API

OleDbCommand.getValue Method

This method returns the value of the specific column in the current row.

Overload List

This method returns the value of the specific column in the current row.

public override object getValue(int);

This method returns the value of the specific column in the current row.

public override object getValue(string);

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.getValue Method (Int32)

This method returns the value of the specific column in the current row.

public override object getValue(
int colIndex
);

Parameters

colIndex
Specify index of the column.

Return Value

Returns an object.i.e Value of the specific column.

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.getValue Overload List


OleDbCommand.getValue Method (String)

This method returns the value of the specific column in the current row.

public override object getValue(
string columnName
);

Parameters

columnName
Name of column of a table

Return Value

Returns an object.i.e Value of the specific column.

Example

[C#]

//  The following example will demonstrate the use of getValue method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            // Use of getValue function.
            if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.getValue Overload List


IsNull Method

TierDeveloper Framework API

OleDbCommand.IsNull Method

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

Overload List

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(int);

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(string);

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.IsNull Method (Int32)

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(
int colIndex
);

Parameters

colIndex
Index of the column.

Return Value

Returns bool value either true or false.

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.IsNull Overload List


OleDbCommand.IsNull Method (String)

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(
string columnName
);

Parameters

columnName
Name of the column of a specific table.

Return Value

Returns bool value either true or false.

Example

[C#]

//  The following example will demonstrate the use of IsNull method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            // Use of IsNull function.
            if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.IsNull Overload List


OleDbCommand.PopulateDataSet Method

This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.

public override void PopulateDataSet(
string dataTableName,
ref DataSet dataSet
);

Parameters

dataTableName
Name of the table.
dataSet
Pass DataSet object by reference.

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.Prepare Method

This method constructs the.NET Data Provider specific Command object.

public override void Prepare(
string commandString,
bool isStoredProc
);

Parameters

commandString
Used to specify the command.
isStoredProc
Boolean variable to specify whether command is to be created for Stored Procedure or not.

Example

[C#]

// The following demonstrates the use of Prepare method.

 public void UsePrepare(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    // Apply your own logic here

    myConnection.CloseConnection();
}

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.PrepareNew Method

This method creates a new .NET Data Provider specific Command object if it not created.

public override void PrepareNew(
string commandString,
bool isStoredProc
);

Parameters

commandString
Used to specify the command.
isStoredProc
Boolean variable to specify whether command is to be created for Stored Procedure or not.

Example

[C#]

// The following demonstrates the use of PrepareNew method.

 public void UsePrepareNew(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

    myCommand.PrepareNew(STD_INSERT_SQL, USE_STORE_PROC);

    // Apply your own logic here

    myConnection.CloseConnection();
}

See Also

OleDbCommand Class | TDevFramework Namespace


ProcessDataSet Method

TierDeveloper Framework API

OleDbCommand.ProcessDataSet Method

This feature is not included in TierDeveloper 5.0

Overload List

This feature is not included in TierDeveloper 5.0

public override void ProcessDataSet(DataSet);

This feature is not included in TierDeveloper 5.0

public override void ProcessDataSet(string,DataSet);

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.ProcessDataSet Method (DataSet)

This feature is not included in TierDeveloper 5.0

public override void ProcessDataSet(
DataSet dataSet
);

Parameters

dataSet

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.ProcessDataSet Overload List


OleDbCommand.ProcessDataSet Method (String, DataSet)

This feature is not included in TierDeveloper 5.0

public override void ProcessDataSet(
string dataTableName,
DataSet dataSet
);

Parameters

dataTableName
dataSet

See Also

OleDbCommand Class | TDevFramework Namespace | OleDbCommand.ProcessDataSet Overload List


OleDbCommand.Read Method

This is a wrapper method and makes call to the Read method of OleDbDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.

public override bool Read();

Return Value

Returns bool value either true or false.

Example

[C#]

//  The following example will demonstrate the use of Read method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.ReadBytes Method

This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.

public override void ReadBytes(
string columnName,
long dataIndex,
byte[] buffer,
int buffIndex,
int length
);

Parameters

columnName
Name of the column
dataIndex
buffer
buffer array of byte type.
buffIndex
Index of buffer
length
length

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.Release Method

This method closes the DataReader object associated with the Command object and disposes the Command object.

public override void Release();

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbCommand.ReleaseReader Method

This method release the DataReader object associated with the Command object.

public override void ReleaseReader();

Example

[C#]

//  The following example will demonstrate the use of ReleaseReader method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }

        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OleDbCommand Class | TDevFramework Namespace


OleDbConnection Class

This is a derivation of the TDevFramework “Connection” class and provides the implementation for the .NET Data Provider for OLE DB. The purpose of this class is to facilitate the construction of an OleDbConnection object.

For a list of all members of this type, see OleDbConnection Members.

System.Object
TDevFramework.Connection
TDevFramework.OleDbConnection

public class OleDbConnection : Connection

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

[C#]

// The following example creates a OleDbConnection using TDevFramework.OleDbConnection class.

 public void CreateConnection(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=Northwind;" + "Integrated Security=SSPI;";
    }
    OleDbConnection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

OleDbConnection Members | TDevFramework Namespace


OleDbConnection Members

OleDbConnection overview

Public Instance Constructors

OleDbConnection Overloaded. Initializes a new instance of the OleDbConnection class.

Public Instance Properties

Transaction Gets the current transaction object.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
CloseConnection | This method closes the currently opened connection and sets the IsOpen flag to false.
CreateCommand | This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.
Equals (inherited from Object) |
getConnection | This method returns the connection object.
getConnectionString (inherited from Connection) | Gets the connection string.
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IsManualTransaction (inherited from Connection) | Determines whether transaction is manual or not.
IsOpen (inherited from Connection) | Determines whether connection is open or not and return true or false accordingly.
OpenConnection | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
OpenConnection (inherited from Connection) | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
SetAbort | This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.
SetManualTransaction (inherited from Connection) | This method sets the transaction as manual.
SetStatus | This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.
ToString (inherited from Object) |

Protected Instance Fields

_connectionString (inherited from Connection) | Used to specify the connectin string.
_isManualTransaction (inherited from Connection) | Used to see whether transaction is manually started or not.
_isOpen (inherited from Connection) | Used to see whether connectin is open or close.

Protected Instance Methods

Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
setOpen (inherited from Connection) | This method sets the _isOpen property to true or false.

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection Constructor

This is the constructor for OleDbConnection class and it constructs the OleDbConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

Overload List

This is the constructor for OleDbConnection class and it constructs the OleDbConnection object.

public OleDbConnection(object);

This is the constructor for OleDbConnection class and it constructs the OleDbConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

public OleDbConnection(string);

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection Constructor (String)

This is the constructor for OleDbConnection class and it constructs the OleDbConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

public OleDbConnection(
string connectionString
);

Parameters

connectionString
String that contains the connection string for the database.

See Also

OleDbConnection Class | TDevFramework Namespace | OleDbConnection Constructor Overload List


OleDbConnection Constructor (Object)

This is the constructor for OleDbConnection class and it constructs the OleDbConnection object.

public OleDbConnection(
object connection
);

Parameters

connection

See Also

OleDbConnection Class | TDevFramework Namespace | OleDbConnection Constructor Overload List


OleDbConnection Properties

The properties of the OleDbConnection class are listed below. For a complete list of OleDbConnection class members, see the OleDbConnection Members topic.

Public Instance Properties

Transaction Gets the current transaction object.

See Also

OleDbConnection Class | TDevFramework Namespace


Transaction Property

TierDeveloper Framework API

OleDbConnection.Transaction Property

Gets the current transaction object.

public override object Transaction {get;}

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection Methods

The methods of the OleDbConnection class are listed below. For a complete list of OleDbConnection class members, see the OleDbConnection Members topic.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
CloseConnection | This method closes the currently opened connection and sets the IsOpen flag to false.
CreateCommand | This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.
Equals (inherited from Object) |
getConnection | This method returns the connection object.
getConnectionString (inherited from Connection) | Gets the connection string.
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IsManualTransaction (inherited from Connection) | Determines whether transaction is manual or not.
IsOpen (inherited from Connection) | Determines whether connection is open or not and return true or false accordingly.
OpenConnection | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
OpenConnection (inherited from Connection) | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
SetAbort | This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.
SetManualTransaction (inherited from Connection) | This method sets the transaction as manual.
SetStatus | This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
setOpen (inherited from Connection) | This method sets the _isOpen property to true or false.

See Also

OleDbConnection Class | TDevFramework Namespace


BeginTransaction Method

TierDeveloper Framework API

OleDbConnection.BeginTransaction Method

Starts the transaction.

Overload List

Starts the transaction.

public override object BeginTransaction();

Starts the transaction.

public override object BeginTransaction(IsolationLevel);

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection.BeginTransaction Method ()

Starts the transaction.

public override object BeginTransaction();

Return Value

transaction object.

Example

[C#]

//  The following example will demonstrate the use of SetStatus method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);

        // Start the transaction.
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();

        // Call this method to set status of transaction.
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OleDbConnection Class | TDevFramework Namespace | OleDbConnection.BeginTransaction Overload List


OleDbConnection.BeginTransaction Method (IsolationLevel)

Starts the transaction.

public override object BeginTransaction(
IsolationLevel isolationLevel
);

Parameters

isolationLevel
The IsolationLevel values are used by a .NET Framework data provider when performing a transaction.

Return Value

object

See Also

OleDbConnection Class | TDevFramework Namespace | OleDbConnection.BeginTransaction Overload List


OleDbConnection.CloseConnection Method

This method closes the currently opened connection and sets the IsOpen flag to false.

public override void CloseConnection();

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection.CreateCommand Method

This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.

public override Command CreateCommand(
string commandString,
bool isStoredProc
);

Parameters

commandString
isStoredProc
bool value

Return Value

Command object

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

[C#]

// The following example demonstrates the use of CreateCommand method.

 public void CreateCommand(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    string mySelectQuery = "SELECT EmpNo, DeptNo FROM Emp";
    OleDbConnection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
    myConnection.OpenConnection();

    // Create a new Command
    Command myCommand = myConnection.CreateCommand(mySelectQuery,false);

    // Apply your own logic here.

    // Always close your connection.
    myConnection.CloseConnection();

  }

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection.getConnection Method

This method returns the connection object.

public override object getConnection();

Return Value

connection object

Example

[C#]

// The following example demonstrates the use of getConnection method.

 public void CreateConnection(Connection myConnection, string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }

    // Now connection contains the object returned by the getConnection method.
    OleDbConnection connection = (OleDbConnection) myConnection.getConnection();

    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

See Also

OleDbConnection Class | TDevFramework Namespace


OpenConnection Method

TierDeveloper Framework API

OleDbConnection.OpenConnection Method

Opens a database connection with the property settings specified by the ConnectionString

Overload List

Inherited from Connection.

public object OpenConnection();

Opens a database connection with the property settings specified by the ConnectionString

public override object OpenConnection(string);

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection.OpenConnection Method (String)

Opens a database connection with the property settings specified by the ConnectionString

public override object OpenConnection(
string connectionString
);

Parameters

connectionString
String that contains the connection string for the database.

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

[C#]

// The following example demonstrates the use of OpenConnection method.

 public void CreateConnection(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    OleDbConnection myConnection = new TDevFramework.OleDbConnection(myConnectionString);

    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

See Also

OleDbConnection Class | TDevFramework Namespace | OleDbConnection.OpenConnection Overload List


OleDbConnection.SetAbort Method

This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.

public override void SetAbort();

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection.SetComplete Method

This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.

public override void SetComplete();

See Also

OleDbConnection Class | TDevFramework Namespace


OleDbConnection.SetStatus Method

This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.

public override void SetStatus(
EStatus eStatus
);

Parameters

eStatus
It represents the status for a transaction and is used in SetStatus method of TDevFramework Connection class that causes the transaction to complete or abort based on this value.

Example

[C#]

//  The following example will demonstrate the use of SetStatus method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OleDbConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OleDbCommand((System.Data.OleDb.OleDbConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();

        // Call this method to set status of transaction.
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OleDbConnection Class | TDevFramework Namespace


OracleCommand Class

This class is derived from TDevFramework “Command” class and provides the implementation for the .NET native Data Provider for Oracle. The purpose of this class is to facilitate the construction of an OracleCommand object and its related objects that includes Parameter and DataSet.

For a list of all members of this type, see OracleCommand Members.

System.Object
TDevFramework.Command
TDevFramework.OracleCommand

public class OracleCommand : Command

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

[C#]

// The following example creates a OracleCommand using TDevFramework.OracleCommand class.

 public void UseOracleCommand(Course objInfo,string myConnectionString)
 {
    const String STD_UPDATE_SQL = @"UPDATE Course SET course_name = ? , credit_hours = ? WHERE course_id = ?";
    bool USE_STORE_PROC =  false;

   // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection

    myConnection.OpenConnection();

    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_UPDATE_SQL, USE_STORE_PROC);
    myConnection.BeginTransaction();

    // Now add parameter to your myCommand object e.g.
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
    myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

    myCommand.ExecuteNonQuery();

    myConnection.SetStatus();
    // Always close your  connection.
    myConnection.CloseConnection();

  }

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

OracleCommand Members | TDevFramework Namespace


OracleCommand Members

OracleCommand overview

Public Instance Constructors

OracleCommand Constructor This is the constructor for OracleCommand class and it constructs the OracleCommand object based on the associated OracleConnection object passed via connection parameter.

Public Instance Properties

Transaction Gets/Sets the current transaction object.

Public Instance Methods

AddParameter | Overloaded. This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around OracleDataReader.GetBytes method.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of OracleDataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of OracleDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getParameterValue | This method returns the value for the specified parameter from the parameters collection associated with the Command object.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
IsNull | Overloaded. This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
Prepare | This method constructs the.NET Data Provider specific Command object.
PrepareNew | This method creates a new .NET Data Provider specific Command object if it not created.
ProcessDataSet | Overloaded. This feature is not included in TierDeveloper 5.0
Read | This is a wrapper method and makes call to the Read method of OracleDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReadBytes | This is a wrapper method around GetBytes method of OracleDataReader and reads the byte stream for the specified column into the buffer parameter.
Release | This method closes the OracleDataReader object associated with the Command object and disposes the Command object.
ReleaseReader | This method release the OracleDataReader object associated with the Command object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
getParamDirection (inherited from Command) | Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet
MemberwiseClone (inherited from Object) |

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand Constructor

This is the constructor for OracleCommand class and it constructs the OracleCommand object based on the associated OracleConnection object passed via connection parameter.

public OracleCommand(
OracleConnection connection
);

Parameters

connection
Object of System.Data.OracleClient.OracleConnection.

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand Properties

The properties of the OracleCommand class are listed below. For a complete list of OracleCommand class members, see the OracleCommand Members topic.

Public Instance Properties

Transaction Gets/Sets the current transaction object.

See Also

OracleCommand Class | TDevFramework Namespace


Transaction Property

TierDeveloper Framework API

OracleCommand.Transaction Property

Gets/Sets the current transaction object.

public override object Transaction {get; set;}

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand Methods

The methods of the OracleCommand class are listed below. For a complete list of OracleCommand class members, see the OracleCommand Members topic.

Public Instance Methods

AddParameter | Overloaded. This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around OracleDataReader.GetBytes method.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of OracleDataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of OracleDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getParameterValue | This method returns the value for the specified parameter from the parameters collection associated with the Command object.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
IsNull | Overloaded. This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
Prepare | This method constructs the.NET Data Provider specific Command object.
PrepareNew | This method creates a new .NET Data Provider specific Command object if it not created.
ProcessDataSet | Overloaded. This feature is not included in TierDeveloper 5.0
Read | This is a wrapper method and makes call to the Read method of OracleDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReadBytes | This is a wrapper method around GetBytes method of OracleDataReader and reads the byte stream for the specified column into the buffer parameter.
Release | This method closes the OracleDataReader object associated with the Command object and disposes the Command object.
ReleaseReader | This method release the OracleDataReader object associated with the Command object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
getParamDirection (inherited from Command) | Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet
MemberwiseClone (inherited from Object) |

See Also

OracleCommand Class | TDevFramework Namespace


AddParameter Method

TierDeveloper Framework API

OracleCommand.AddParameter Method

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

Overload List

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,bool);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,int);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,int,bool);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,EParamDirection);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,EParamDirection,int);

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.AddParameter Method (String, EDataType, Object, EParamDirection)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput);

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.AddParameter Overload List


OracleCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Boolean)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
bool bNull
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
bNull
Determine whether value is null or not.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.AddParameter Overload List


OracleCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Int32)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, size);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, size);

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.AddParameter Overload List


OracleCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Int32, Boolean)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size,
bool bNull
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size
bNull
Determine whether value is null or not.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, size,objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, size,objInfo.IsNull("credit_hours"));

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.AddParameter Overload List


OracleCommand.AddParameter Method (String, EDataType, EParamDirection)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
EParamDirection direction
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar,  TDevFramework.EParamDirection.eInput);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt,  TDevFramework.EParamDirection.eInput);

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.AddParameter Overload List


OracleCommand.AddParameter Method (String, EDataType, EParamDirection, Int32)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
EParamDirection direction,
int size
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, size);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, size );

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.AddParameter Overload List


OracleCommand.ExecuteNonQuery Method

Executes a Transact-SQL statement against the connection and returns the number of rows affected.

public override int ExecuteNonQuery();

Return Value

number of rows affected

Example

[C#]

// The following example demonstrates the use of ExecuteNonQuery method.

 public void UseExecuteNonQuery(Course objInfo,string myConnectionString)
 {
    const String STD_UPDATE_SQL = "spCourseUpdate";
    bool USE_STORE_PROC =  true;

   // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection

    myConnection.OpenConnection();

    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    Prepare(STD_UPDATE_SQL, USE_STORE_PROC);
    myConnection.BeginTransaction();

    // Now add parameter to your myCommand object e.g.
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
    myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

    myCommand.ExecuteNonQuery();

    myConnection.SetStatus();
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.ExecuteReader Method

Executes commands that return rows.

public override void ExecuteReader();

Example

[C#]

//  The following example will demonstrate the use of ExecuteReader method.

    public void Load(Course objInfo ,string myConnectionString)
    {
        const String STD_LOAD_SQL = @"SELECT t2.course_id course_id , t2.course_name course_name , t2.credit_hours credit_hours FROM Course t2 WHERE t2.course_id = ?";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
        }
        Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
        myCommand.Prepare(STD_LOAD_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

        myCommand.ExecuteReader();

        while(myCommand.Read())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(myCommand.getValue("course_id"));
            if (!IsNull("course_name")) objInfo.course_name = Convert.ToString(myCommand.getValue("course_name"));
            if (!IsNull("credit_hours")) objInfo.credit_hours = Convert.ToInt32(myCommand.getValue("credit_hours"));
            objInfo.IsNew = false;
            objInfo.Dirty = false;
        }

        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.ExecuteScalar Method

Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.

public override object ExecuteScalar();

Return Value

object i.e returns the first column of the first row.

Example

[C#]

//  The following example will demonstrate the use of ExecuteScalar function.

public Int32 FindByStudentCount( Int32 n32prmstudent_id, string myConnectionString)
{
    const String FindByStudent_SQL = @"SELECT t1.course_id course_id, t1.course_name course_name,t1.credit_hours credit_hours FROM Course t1 INNER JOIN  CourseTaken a1 ON t1.course_id = a1.course_id WHERE (a1.student_id = ?)";
    Int32 recordCount = 0;
    try
    {
        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
        }
        Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());

        objInfo.ValidateRequiredFields();
        myCommand.Prepare(FindByStudentCount_SQL, false);
        test.BeginTransaction();
        myCommand.AddParameter("@prmstudent_id", TDevFramework.EDataType.eInt, n32prmstudent_id, EParamDirection.eInput);

        recordCount = Convert.ToInt32(myCommand.ExecuteScalar());
        myCommand.SetStatus(EStatus.eSuccess);
        myCommand.ReleaseCommand();
    }
    catch (Exception e)
    {
        test.SetStatus(EStatus.eFail);
        test.ReleaseCommand();
    }
    return recordCount;
}

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.getBytes Method

This method is a wrapper around OracleDataReader.GetBytes method.

public override byte[] getBytes(
string columnName
);

Parameters

columnName

Return Value

Returns array of bytes.

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.getByteSize Method

This method returns total number of bytes in the target binary attribute.

public override long getByteSize(
string columnName
);

Parameters

columnName

Return Value

long.

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.GetDataSet Method

This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.

public override DataSet GetDataSet(
string tableName
);

Return Value

DataSet object

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.getFieldCount Method

This is wrapper around FieldCount property of OracleDataReader and returns number of columns in the current row.

public override int getFieldCount();

Return Value

int

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.getFieldName Method

This is wrapper around GetName method of OracleDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.

public override string getFieldName(
int index
);

Parameters

index
index parameter for DataReader so that he can filter the data from row.

Return Value

string

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.getParameterValue Method

This method returns the value for the specified parameter from the parameters collection associated with the Command object.

public override object getParameterValue(
string parameterName
);

Parameters

parameterName
Specified parameter from the parameters collection associated with the Command object.

Return Value

object i.e. value for the specified parameter.

See Also

OracleCommand Class | TDevFramework Namespace


getValue Method

TierDeveloper Framework API

OracleCommand.getValue Method

This method returns the value of the specific column in the current row.

Overload List

This method returns the value of the specific column in the current row.

public override object getValue(int);

This method returns the value of the specific column in the current row.

public override object getValue(string);

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.getValue Method (Int32)

This method returns the value of the specific column in the current row.

public override object getValue(
int colIndex
);

Parameters

colIndex
Specify index of the column.

Return Value

Returns an object.i.e Value of the specific column.

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.getValue Overload List


OracleCommand.getValue Method (String)

This method returns the value of the specific column in the current row.

public override object getValue(
string columnName
);

Parameters

columnName
Name of column of a table

Return Value

Returns an object.i.e Value of the specific column.

Example

[C#]

//  The following example will demonstrate the use of getValue method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
        }
        Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            // Use of getValue function.
            if (!myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.getValue Overload List


IsNull Method

TierDeveloper Framework API

OracleCommand.IsNull Method

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

Overload List

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(int);

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(string);

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.IsNull Method (Int32)

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(
int colIndex
);

Parameters

colIndex
Index of the column.

Return Value

Returns bool value either true or false.

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.IsNull Overload List


OracleCommand.IsNull Method (String)

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(
string columnName
);

Parameters

columnName
Name of the column of a specific table.

Return Value

Returns bool value either true or false.

Example

[C#]

//  The following example will demonstrate the use of IsNull method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
        }
        Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            // Use of IsNull function.
            if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.IsNull Overload List


OracleCommand.PopulateDataSet Method

This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.

public override void PopulateDataSet(
string dataTableName,
ref DataSet dataSet
);

Parameters

dataTableName
Name of the table.
dataSet
Pass DataSet object by reference.

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.Prepare Method

This method constructs the.NET Data Provider specific Command object.

public override void Prepare(
string commandString,
bool isStoredProc
);

Parameters

commandString
Used to specify the command.
isStoredProc
Boolean variable to specify whether command is to be created for Stored Procedure or not.

Example

[C#]

//  The following example will demonstrate the use of Prepare method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
        }
        Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
        // open the connection
        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
        objInfo.ValidateRequiredFields();

        myCommand.Prepare(STD_INSERT_SQL, false);

        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
        myCommand.ExecuteReader();
        if (myCommand.Read ())
        {
            if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.PrepareNew Method

This method creates a new .NET Data Provider specific Command object if it not created.

public override void PrepareNew(
string commandString,
bool isStoredProc
);

Parameters

commandString
Used to specify the command.
isStoredProc
Boolean variable to specify whether command is to be created for Stored Procedure or not.

Example

[C#]

// The following demonstrates the use of PrepareNew method.

 public void UsePrepareNew(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());

    myCommand.PrepareNew(STD_INSERT_SQL, USE_STORE_PROC);

    // Apply your own logic here

    myConnection.CloseConnection();
}

See Also

OracleCommand Class | TDevFramework Namespace


ProcessDataSet Method

TierDeveloper Framework API

OracleCommand.ProcessDataSet Method

This feature is not included in TierDeveloper 5.0

Overload List

This feature is not included in TierDeveloper 5.0

public override void ProcessDataSet(DataSet);

This feature is not included in TierDeveloper 5.0

public override void ProcessDataSet(string,DataSet);

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.ProcessDataSet Method (DataSet)

This feature is not included in TierDeveloper 5.0

public override void ProcessDataSet(
DataSet dataSet
);

Parameters

dataSet

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.ProcessDataSet Overload List


OracleCommand.ProcessDataSet Method (String, DataSet)

This feature is not included in TierDeveloper 5.0

public override void ProcessDataSet(
string dataTableName,
DataSet dataSet
);

Parameters

dataTableName
dataSet

See Also

OracleCommand Class | TDevFramework Namespace | OracleCommand.ProcessDataSet Overload List


OracleCommand.Read Method

This is a wrapper method and makes call to the Read method of OracleDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.

public override bool Read();

Return Value

Returns bool value either true or false.

Example

[C#]

//  The following example will demonstrate the use of Prepare method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
        }
        Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
        // open the connection
        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.ReadBytes Method

This is a wrapper method around GetBytes method of OracleDataReader and reads the byte stream for the specified column into the buffer parameter.

public override void ReadBytes(
string columnName,
long dataIndex,
byte[] buffer,
int buffIndex,
int length
);

Parameters

columnName
Name of the column
dataIndex
buffer
buffer array of byte type.
buffIndex
Index of buffer
length
length

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.Release Method

This method closes the OracleDataReader object associated with the Command object and disposes the Command object.

public override void Release();

See Also

OracleCommand Class | TDevFramework Namespace


OracleCommand.ReleaseReader Method

This method release the OracleDataReader object associated with the Command object.

public override void ReleaseReader();

Example

[C#]

//  The following example will demonstrate the use of ExecuteReader method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=Oracle8i;Integrated Security=yes";
        }
        Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }

        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OracleCommand Class | TDevFramework Namespace


OracleConnection Class

This is a derivation of the TDevFramework “Connection” class and provides the implementation for the .NET native Data Provider for Oracle. The purpose of this class is to facilitate the construction of an OracleConnection object.

For a list of all members of this type, see OracleConnection Members.

System.Object
TDevFramework.Connection
TDevFramework.OracleConnection

public class OracleConnection : Connection

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

[C#]

// The following example creates a OracleConnection using TDevFramework.OracleConnection class.

 public void CreateConnection(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=Oracle9i;Integrated Security=yes";
    }
    OracleConnection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

OracleConnection Members | TDevFramework Namespace


OracleConnection Members

OracleConnection overview

Public Instance Constructors

OracleConnection Overloaded. Initializes a new instance of the OracleConnection class.

Public Instance Properties

Transaction Gets the current transaction.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
CloseConnection | This method closes the currently opened connection and sets the IsOpen flag to false.
CreateCommand | This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.
Equals (inherited from Object) |
getConnection | This method returns the connectin object.
getConnectionString (inherited from Connection) | Gets the connection string.
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IsManualTransaction (inherited from Connection) | Determines whether transaction is manual or not.
IsOpen (inherited from Connection) | Determines whether connection is open or not and return true or false accordingly.
OpenConnection | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
OpenConnection (inherited from Connection) | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
SetAbort | This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.
SetManualTransaction (inherited from Connection) | This method sets the transaction as manual.
SetStatus |
ToString (inherited from Object) |

Protected Instance Fields

_connectionString (inherited from Connection) | Used to specify the connectin string.
_isManualTransaction (inherited from Connection) | Used to see whether transaction is manually started or not.
_isOpen (inherited from Connection) | Used to see whether connectin is open or close.

Protected Instance Methods

Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
setOpen (inherited from Connection) | This method sets the _isOpen property to true or false.

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection Constructor

This is the constructor for OracleConnection class and it constructs the OracleConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

Overload List

This is the constructor for OracleConnection class and it constructs the OracleConnection object.

public OracleConnection(object);

This is the constructor for OracleConnection class and it constructs the OracleConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

public OracleConnection(string);

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection Constructor (String)

This is the constructor for OracleConnection class and it constructs the OracleConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

public OracleConnection(
string connectionString
);

Parameters

connectionString
parameter for connection string.

See Also

OracleConnection Class | TDevFramework Namespace | OracleConnection Constructor Overload List


OracleConnection Constructor (Object)

This is the constructor for OracleConnection class and it constructs the OracleConnection object.

public OracleConnection(
object connection
);

Parameters

connection

See Also

OracleConnection Class | TDevFramework Namespace | OracleConnection Constructor Overload List


OracleConnection Properties

The properties of the OracleConnection class are listed below. For a complete list of OracleConnection class members, see the OracleConnection Members topic.

Public Instance Properties

Transaction Gets the current transaction.

See Also

OracleConnection Class | TDevFramework Namespace


Transaction Property

TierDeveloper Framework API

OracleConnection.Transaction Property

Gets the current transaction.

public override object Transaction {get;}

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection Methods

The methods of the OracleConnection class are listed below. For a complete list of OracleConnection class members, see the OracleConnection Members topic.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
CloseConnection | This method closes the currently opened connection and sets the IsOpen flag to false.
CreateCommand | This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.
Equals (inherited from Object) |
getConnection | This method returns the connectin object.
getConnectionString (inherited from Connection) | Gets the connection string.
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IsManualTransaction (inherited from Connection) | Determines whether transaction is manual or not.
IsOpen (inherited from Connection) | Determines whether connection is open or not and return true or false accordingly.
OpenConnection | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
OpenConnection (inherited from Connection) | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
SetAbort | This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.
SetManualTransaction (inherited from Connection) | This method sets the transaction as manual.
SetStatus |
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
setOpen (inherited from Connection) | This method sets the _isOpen property to true or false.

See Also

OracleConnection Class | TDevFramework Namespace


BeginTransaction Method

TierDeveloper Framework API

OracleConnection.BeginTransaction Method

Starts the transaction.

Overload List

Starts the transaction.

public override object BeginTransaction();

Starts the transaction.

public override object BeginTransaction(IsolationLevel);

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection.BeginTransaction Method ()

Starts the transaction.

public override object BeginTransaction();

Return Value

object

See Also

OracleConnection Class | TDevFramework Namespace | OracleConnection.BeginTransaction Overload List


OracleConnection.BeginTransaction Method (IsolationLevel)

Starts the transaction.

public override object BeginTransaction(
IsolationLevel isolationLevel
);

Parameters

isolationLevel
The IsolationLevel values are used by a .NET Framework data provider when performing a transaction.

Return Value

object

See Also

OracleConnection Class | TDevFramework Namespace | OracleConnection.BeginTransaction Overload List


OracleConnection.CloseConnection Method

This method closes the currently opened connection and sets the IsOpen flag to false.

public override void CloseConnection();

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection.CreateCommand Method

This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.

public override Command CreateCommand(
string commandString,
bool isStoredProc
);

Parameters

commandString
isStoredProc
bool value

Return Value

Command object

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

[C#]

// The following example will demonstrate the use of CreateCommand method.

 public void CreateCommand(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    string mySelectQuery = "SELECT EmpNo, DeptNo FROM Emp";
    OracleConnection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    myConnection.OpenConnection();

    // Create a new Command
    Command myCommand = myConnection.CreateCommand(mySelectQuery,false);

    // Apply your own logic here.

    // Always close your connection.
    myConnection.CloseConnection();

  }

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection.getConnection Method

This method returns the connectin object.

public override object getConnection();

Return Value

object

Example

[C#]

// The following example demonstrates the use of getConnection method.

 public void CreateConnection(Connection myConnection, string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }

    // Now connection contains the object returned by the getConnection method.
    OracleConnection connection = (OracleConnection)myConnection.getConnection();

    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

See Also

OracleConnection Class | TDevFramework Namespace


OpenConnection Method

TierDeveloper Framework API

OracleConnection.OpenConnection Method

Opens a database connection with the property settings specified by the ConnectionString

Overload List

Inherited from Connection.

public object OpenConnection();

Opens a database connection with the property settings specified by the ConnectionString

public override object OpenConnection(string);

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection.OpenConnection Method (String)

Opens a database connection with the property settings specified by the ConnectionString

public override object OpenConnection(
string connectionString
);

Parameters

connectionString
String that contains the connection string for the database.

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

[C#]

// The following example demonstrates the use of OpenConnection method.

 public void CreateConnection(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    OracleConnection myConnection = new TDevFramework.OracleConnection(myConnectionString);

    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

See Also

OracleConnection Class | TDevFramework Namespace | OracleConnection.OpenConnection Overload List


OracleConnection.SetAbort Method

This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.

public override void SetAbort();

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection.SetComplete Method

This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.

public override void SetComplete();

See Also

OracleConnection Class | TDevFramework Namespace


OracleConnection.SetStatus Method

public override void SetStatus(
EStatus eStatus
);

Parameters

eStatus
It represents the status for a transaction and is used in SetStatus method of TDevFramework Connection class that causes the transaction to complete or abort based on this value.

Example

[C#]

//  The following example will demonstrate the use of SetStatus method.

    public void Insert(Course objInfo ,string myConnString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();

        // Call this method to set status of transaction.
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

OracleConnection Class | TDevFramework Namespace


PersistentField Class

This class manages the state information for the individual attribute for an Object.

For a list of all members of this type, see PersistentField Members.

System.Object
TDevFramework.PersistentField
TDevFramework.PersistentMembershipField
TDevFramework.PersistentRangeField

public class PersistentField

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

This class maintains the attribute state value and provides the relevant services to determine the properties of the attribute and its value that includes information if the attribute value is NULL and it corresponds to a required table attribute in the target database.

Example

[C#]

//    The following example is for PersistentField class.

public class Customer : PersistentObject
{
    public Customer()
    {
        SetupFields();
    }

    private void SetupFields()
    {
        // AddField method is used to add a PersistentField

        AddField(new PersistentField("customer_id", true, true, TDevFramework.EDataType.eInt));
        AddField(new PersistentField("company", false, false, TDevFramework.EDataType.eVarchar));
        AddField(new PersistentField("firstname", false, false, TDevFramework.EDataType.eVarchar));
        AddField(new PersistentField("lastname", false, false, TDevFramework.EDataType.eVarchar));
        AddField(new PersistentField("email_addr", false, false, TDevFramework.EDataType.eVarchar));

    }

}

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

PersistentField Members | TDevFramework Namespace


PersistentField Members

PersistentField overview

Public Instance Constructors

PersistentField Overloaded. Initializes a new instance of the PersistentField class.

Public Instance Properties

Dirty | This is a read-only property that determines if the attribute represented by this PersistentField object has been set to a value and returns true, otherwise it returns false.
Name | This is a read-only property that returns the name of the attribute represented by this PersistentField object.
Null | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
ReadOnly | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
Required | This is a read-only property that determines if the target column associated with the attribute represented by this PersistentField object is required and returns true, otherwise it returns false for an optional attribute.
Type | This is a read-only property that returns the .NET data type for the attribute represented by this PersistentField object. For a list of available data types, refer to EDataType enumeration in this document.
Value | This property lets the user change the value of the PersistentField object.

Public Instance Methods

Equals (inherited from Object)
GetHashCode (inherited from Object)
GetType (inherited from Object)
ToString (inherited from Object)

Protected Instance Fields

_dataType It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute. The list of available data types is shown below. Each data type corresponds to a .NET data type.

Protected Instance Methods

Finalize (inherited from Object)
MemberwiseClone (inherited from Object)

See Also

PersistentField Class | TDevFramework Namespace


PersistentField Constructor

Default constructor.

Overload List

Default constructor.

public PersistentField();

Initializes a new instance of PersistentField class.

public PersistentField(string,bool,bool,EDataType);

Initializes a new instance of PersistentField class.

public PersistentField(string,bool,bool,EDataType,object);

See Also

PersistentField Class | TDevFramework Namespace


PersistentField Constructor ()

Default constructor.

public PersistentField();

See Also

PersistentField Class | TDevFramework Namespace | PersistentField Constructor Overload List


PersistentField Constructor (String, Boolean, Boolean, EDataType, Object)

Initializes a new instance of PersistentField class.

public PersistentField(
string name,
bool isRequired,
bool isReadOnly,
EDataType dataType,
object defaultVal
);

Parameters

name
Name of the field.
isRequired
bool parameter whether field is required or not.
isReadOnly
bool parameter for readonly object.
dataType
Specify EDataType.
defaultVal
Specifies default value.

See Also

PersistentField Class | TDevFramework Namespace | PersistentField Constructor Overload List


PersistentField Constructor (String, Boolean, Boolean, EDataType)

Initializes a new instance of PersistentField class.

public PersistentField(
string name,
bool isRequired,
bool isReadOnly,
EDataType dataType
);

Parameters

name
Name of the field.
isRequired
bool parameter whether field is required or not.
isReadOnly
bool parameter for readonly object.
dataType
Specify EDataType.

See Also

PersistentField Class | TDevFramework Namespace | PersistentField Constructor Overload List


PersistentField Fields

The fields of the PersistentField class are listed below. For a complete list of PersistentField class members, see the PersistentField Members topic.

Protected Instance Fields

_dataType It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute. The list of available data types is shown below. Each data type corresponds to a .NET data type.

See Also

PersistentField Class | TDevFramework Namespace


PersistentField._dataType Field

It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute. The list of available data types is shown below. Each data type corresponds to a .NET data type.

protected EDataType _dataType;

See Also

PersistentField Class | TDevFramework Namespace


PersistentField Properties

The properties of the PersistentField class are listed below. For a complete list of PersistentField class members, see the PersistentField Members topic.

Public Instance Properties

Dirty | This is a read-only property that determines if the attribute represented by this PersistentField object has been set to a value and returns true, otherwise it returns false.
Name | This is a read-only property that returns the name of the attribute represented by this PersistentField object.
Null | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
ReadOnly | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
Required | This is a read-only property that determines if the target column associated with the attribute represented by this PersistentField object is required and returns true, otherwise it returns false for an optional attribute.
Type | This is a read-only property that returns the .NET data type for the attribute represented by this PersistentField object. For a list of available data types, refer to EDataType enumeration in this document.
Value | This property lets the user change the value of the PersistentField object.

See Also

PersistentField Class | TDevFramework Namespace


Dirty Property

TierDeveloper Framework API

PersistentField.Dirty Property

This is a read-only property that determines if the attribute represented by this PersistentField object has been set to a value and returns true, otherwise it returns false.

public bool Dirty {get; set;}

See Also

PersistentField Class | TDevFramework Namespace


Name Property

TierDeveloper Framework API

PersistentField.Name Property

This is a read-only property that returns the name of the attribute represented by this PersistentField object.

public string Name {get;}

See Also

PersistentField Class | TDevFramework Namespace


Null Property

TierDeveloper Framework API

PersistentField.Null Property

This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.

public bool Null {get; set;}

See Also

PersistentField Class | TDevFramework Namespace


ReadOnly Property

TierDeveloper Framework API

PersistentField.ReadOnly Property

This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.

public bool ReadOnly {get; set;}

See Also

PersistentField Class | TDevFramework Namespace


Required Property

TierDeveloper Framework API

PersistentField.Required Property

This is a read-only property that determines if the target column associated with the attribute represented by this PersistentField object is required and returns true, otherwise it returns false for an optional attribute.

public bool Required {get;}

See Also

PersistentField Class | TDevFramework Namespace


Type Property

TierDeveloper Framework API

PersistentField.Type Property

This is a read-only property that returns the .NET data type for the attribute represented by this PersistentField object. For a list of available data types, refer to EDataType enumeration in this document.

public EDataType Type {get;}

See Also

PersistentField Class | TDevFramework Namespace


Value Property

TierDeveloper Framework API

PersistentField.Value Property

This property lets the user change the value of the PersistentField object.

public virtual object Value {get; set;}

See Also

PersistentField Class | TDevFramework Namespace


PersistentMembershipField Class

This class inherits from PersistentField and provides the functionality to manage the state information for drop-down LOV attributes for an Object.

For a list of all members of this type, see PersistentMembershipField Members.

System.Object
TDevFramework.PersistentField
TDevFramework.PersistentMembershipField

public class PersistentMembershipField : PersistentField

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

This class maintains a list of lookup values that defines the domain for the specific drop-down attribute and provides the relevant services to get and set the list of values. For example “country” attribute in the customers table qualifies to be implemented as PersistentMembershipField where the list of countries can be associated with this attribute.

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

PersistentMembershipField Members | TDevFramework Namespace


PersistentMembershipField Members

PersistentMembershipField overview

Public Instance Constructors

PersistentMembershipField Overloaded. Initializes a new instance of the PersistentMembershipField class.

Public Instance Fields

_values Stores PersistentField in ArrayList for manipulation purposes.

Public Instance Properties

Dirty (inherited from PersistentField) | This is a read-only property that determines if the attribute represented by this PersistentField object has been set to a value and returns true, otherwise it returns false.
Name (inherited from PersistentField) | This is a read-only property that returns the name of the attribute represented by this PersistentField object.
Null (inherited from PersistentField) | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
ReadOnly (inherited from PersistentField) | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
Required (inherited from PersistentField) | This is a read-only property that determines if the target column associated with the attribute represented by this PersistentField object is required and returns true, otherwise it returns false for an optional attribute.
Type (inherited from PersistentField) | This is a read-only property that returns the .NET data type for the attribute represented by this PersistentField object. For a list of available data types, refer to EDataType enumeration in this document.
Value | This property lets the user change the value for the base class PersistentField object.

Public Instance Methods

Equals (inherited from Object) |
GetHashCode (inherited from Object) |
getMembers | It returns the list of associated values for the specific attribute as an ArrayList.
GetType (inherited from Object) |
IsMember | This method determines if the specific item represented by objValue is presented in the associated list and returns true. If the item is not found, it returns false.
setMembers | It associates list of values passed via values parameter with the PersistentMembershipField object.
ToString (inherited from Object) |

Protected Instance Fields

_dataType (inherited from PersistentField) It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute. The list of available data types is shown below. Each data type corresponds to a .NET data type.

Protected Instance Methods

Finalize (inherited from Object)
MemberwiseClone (inherited from Object)

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentMembershipField Constructor

These constructors instantiates the PersistentMembershipField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

Overload List

These constructors instantiates the PersistentMembershipField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentMembershipField();

These constructors instantiates the PersistentMembershipField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentMembershipField(string,bool,bool,EDataType,ArrayList,object);

These constructors instantiates the PersistentMembershipField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentMembershipField(string,bool,bool,EDataType,object);

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentMembershipField Constructor (String, Boolean, Boolean, EDataType, Object)

These constructors instantiates the PersistentMembershipField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentMembershipField(
string name,
bool isRequired,
bool isReadOnly,
EDataType dataType,
object defaultVal
);

Parameters

name
Name of the field.
isRequired
bool parameter.
isReadOnly
bool parameter for readonly objects.
dataType
EdataType parameter.
defaultVal

See Also

PersistentMembershipField Class | TDevFramework Namespace | PersistentMembershipField Constructor Overload List


PersistentMembershipField Constructor ()

These constructors instantiates the PersistentMembershipField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentMembershipField();

See Also

PersistentMembershipField Class | TDevFramework Namespace | PersistentMembershipField Constructor Overload List


PersistentMembershipField Constructor (String, Boolean, Boolean, EDataType, ArrayList, Object)

These constructors instantiates the PersistentMembershipField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentMembershipField(
string name,
bool isRequired,
bool isReadOnly,
EDataType dataType,
ArrayList values,
object defaultVal
);

Parameters

name
Name of the field.
isRequired
bool parameter.
isReadOnly
bool parameter for readonly objects.
dataType
EDataType parameter.
values
ArrayList type parameter for specifing values.
defaultVal

See Also

PersistentMembershipField Class | TDevFramework Namespace | PersistentMembershipField Constructor Overload List


PersistentMembershipField Fields

The fields of the PersistentMembershipField class are listed below. For a complete list of PersistentMembershipField class members, see the PersistentMembershipField Members topic.

Public Instance Fields

_values Stores PersistentField in ArrayList for manipulation purposes.

Protected Instance Fields

_dataType (inherited from PersistentField) It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute. The list of available data types is shown below. Each data type corresponds to a .NET data type.

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentMembershipField._values Field

Stores PersistentField in ArrayList for manipulation purposes.

public ArrayList _values;

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentMembershipField Properties

The properties of the PersistentMembershipField class are listed below. For a complete list of PersistentMembershipField class members, see the PersistentMembershipField Members topic.

Public Instance Properties

Dirty (inherited from PersistentField) | This is a read-only property that determines if the attribute represented by this PersistentField object has been set to a value and returns true, otherwise it returns false.
Name (inherited from PersistentField) | This is a read-only property that returns the name of the attribute represented by this PersistentField object.
Null (inherited from PersistentField) | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
ReadOnly (inherited from PersistentField) | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
Required (inherited from PersistentField) | This is a read-only property that determines if the target column associated with the attribute represented by this PersistentField object is required and returns true, otherwise it returns false for an optional attribute.
Type (inherited from PersistentField) | This is a read-only property that returns the .NET data type for the attribute represented by this PersistentField object. For a list of available data types, refer to EDataType enumeration in this document.
Value | This property lets the user change the value for the base class PersistentField object.

See Also

PersistentMembershipField Class | TDevFramework Namespace


Value Property

TierDeveloper Framework API

PersistentMembershipField.Value Property

This property lets the user change the value for the base class PersistentField object.

public override object Value {get; set;}

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentMembershipField Methods

The methods of the PersistentMembershipField class are listed below. For a complete list of PersistentMembershipField class members, see the PersistentMembershipField Members topic.

Public Instance Methods

Equals (inherited from Object) |
GetHashCode (inherited from Object) |
getMembers | It returns the list of associated values for the specific attribute as an ArrayList.
GetType (inherited from Object) |
IsMember | This method determines if the specific item represented by objValue is presented in the associated list and returns true. If the item is not found, it returns false.
setMembers | It associates list of values passed via values parameter with the PersistentMembershipField object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object)
MemberwiseClone (inherited from Object)

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentMembershipField.getMembers Method

It returns the list of associated values for the specific attribute as an ArrayList.

public ArrayList getMembers();

Return Value

ArrayList object.

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentMembershipField.IsMember Method

This method determines if the specific item represented by objValue is presented in the associated list and returns true. If the item is not found, it returns false.

public bool IsMember(
object objValue
);

Parameters

objValue

Return Value

Returns either true or false.

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentMembershipField.setMembers Method

It associates list of values passed via values parameter with the PersistentMembershipField object.

public void setMembers(
ArrayList values
);

Parameters

values
ArrayList object.

See Also

PersistentMembershipField Class | TDevFramework Namespace


PersistentObject Class

This class serves as the base class for the Component info class and provides state management specific operations for the attributes related with the Object.

For a list of all members of this type, see PersistentObject Members.

System.Object
TDevFramework.PersistentObject

public abstract class PersistentObject

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

PersistentObject class serves as the base class for the Component info class and provides state management specific operations for the attributes related with the Object. It includes construction of the PersistenField objects that are maintained in a Hashtable structure and the accessor methods to manipulate each of the Object’s attributes. The purpose of the PersistentObject class is to encapsulate the reusable functionality at a single point and to avoid the code duplication across components. Additionally it abstracts away the commonly used construction code so that the Component info class implementation becomes simple to read and maintain.

Example

[C#]

//    The following example is for PersistentObject class.

public class Customer : PersistentObject
{
    public Customer()
    {
        SetupFields();
    }

    private void SetupFields()
    {
        // AddField method is used to add a PersistentField

        AddField(new PersistentField("customer_id", true, true, TDevFramework.EDataType.eInt));
        AddField(new PersistentField("company", false, false, TDevFramework.EDataType.eVarchar));
        AddField(new PersistentField("firstname", false, false, TDevFramework.EDataType.eVarchar));
        AddField(new PersistentField("lastname", false, false, TDevFramework.EDataType.eVarchar));
        AddField(new PersistentField("email_addr", false, false, TDevFramework.EDataType.eVarchar));

    }

}

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

PersistentObject Members | TDevFramework Namespace


PersistentObject Members

PersistentObject overview

Public Instance Constructors

PersistentObject Constructor This is the constructor for PersistentObject and creates an empty Hashtable collection for the PersistentField objects.

Public Instance Properties

Dirty | This is a read-only property that determines if the object state is modified and returns true, otherwise it returns false.
IsNew | This property determines if the object state is loaded from the database and returns false, otherwise it returns true if this object represents a new record and is not saved in the database.
Item | Returns PersistentField object.

Public Instance Methods

Equals (inherited from Object) |
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
ToString (inherited from Object) |
ValidateRequiredFields | This method determines if all the required attributes for the specific Object has been assigned values. It iterates over the PersistentField collection and validates if each of the attributes represented by PersistentField object has a value assigned to it or is NULL. If any of the attributes has a NULL value, then this method throws “Field is NULL” exception.

Protected Instance Methods

AddField | This method adds a PersistentField into collection of hashtable
Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
RemoveField | This method removes a PersistentField from the hashtable.

See Also

PersistentObject Class | TDevFramework Namespace


PersistentObject Constructor

This is the constructor for PersistentObject and creates an empty Hashtable collection for the PersistentField objects.

public PersistentObject();

See Also

PersistentObject Class | TDevFramework Namespace


PersistentObject Properties

The properties of the PersistentObject class are listed below. For a complete list of PersistentObject class members, see the PersistentObject Members topic.

Public Instance Properties

Dirty | This is a read-only property that determines if the object state is modified and returns true, otherwise it returns false.
IsNew | This property determines if the object state is loaded from the database and returns false, otherwise it returns true if this object represents a new record and is not saved in the database.
Item | Returns PersistentField object.

See Also

PersistentObject Class | TDevFramework Namespace


Dirty Property

TierDeveloper Framework API

PersistentObject.Dirty Property

This is a read-only property that determines if the object state is modified and returns true, otherwise it returns false.

public bool Dirty {get; set;}

See Also

PersistentObject Class | TDevFramework Namespace


IsNew Property

TierDeveloper Framework API

PersistentObject.IsNew Property

This property determines if the object state is loaded from the database and returns false, otherwise it returns true if this object represents a new record and is not saved in the database.

public bool IsNew {get; set;}

See Also

PersistentObject Class | TDevFramework Namespace


Item Property

TierDeveloper Framework API

PersistentObject.Item Property

Returns PersistentField object.

public PersistentField this[
string szName
] {get;}

See Also

PersistentObject Class | TDevFramework Namespace


PersistentObject Methods

The methods of the PersistentObject class are listed below. For a complete list of PersistentObject class members, see the PersistentObject Members topic.

Public Instance Methods

Equals (inherited from Object) |
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
ToString (inherited from Object) |
ValidateRequiredFields | This method determines if all the required attributes for the specific Object has been assigned values. It iterates over the PersistentField collection and validates if each of the attributes represented by PersistentField object has a value assigned to it or is NULL. If any of the attributes has a NULL value, then this method throws “Field is NULL” exception.

Protected Instance Methods

AddField | This method adds a PersistentField into collection of hashtable
Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
RemoveField | This method removes a PersistentField from the hashtable.

See Also

PersistentObject Class | TDevFramework Namespace


PersistentObject.AddField Method

This method adds a PersistentField into collection of hashtable

protected void AddField(
PersistentField value
);

Parameters

value
PersistentField object.

Example

[C#]
// This method is used to add Persistent field

public void addPersistentField(PersistentField field)
{
    AddField(field);
}

See Also

PersistentObject Class | TDevFramework Namespace


PersistentObject.RemoveField Method

This method removes a PersistentField from the hashtable.

protected void RemoveField(
string name
);

Parameters

name
Name of the PersistentField.

Example

[C#]
// This method is used to remove a Persistent field

public void removePersistentField(string fieldName)
{
    RemoveField(fieldName);
}

See Also

PersistentObject Class | TDevFramework Namespace


PersistentObject.ValidateRequiredFields Method

This method determines if all the required attributes for the specific Object has been assigned values. It iterates over the PersistentField collection and validates if each of the attributes represented by PersistentField object has a value assigned to it or is NULL. If any of the attributes has a NULL value, then this method throws “Field is NULL” exception.

public virtual void ValidateRequiredFields();

Example

[C#]
// This method is used to Validate required Persistentfield.

public void validatePersistentField(Customer objInfo)
{
    try
    {
        objInfo.ValidateRequiredFields();
    }
    catch(Exception)
    {
        // Handle exception here.
    }
}

See Also

PersistentObject Class | TDevFramework Namespace


PersistentRangeField Class

This class inherits from PersistentField and provides the functionality to manage the state information for the attributes that have some range values associated.

For a list of all members of this type, see PersistentRangeField Members.

System.Object
TDevFramework.PersistentField
TDevFramework.PersistentRangeField

public class PersistentRangeField : PersistentField

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

PersistentRangeField class inherited from PersistentField and provides the functionality to manage the state information for the attributes that have some range values associated. It maintains a pair of maximum and minimum values that defines the range checking criteria limits and provides the relevant services to manipulate and validate the attribute value based on range criteria. For example “discount_percentage” attribute can have “0” and “75” as the minimum and maximum values as the range criteria.

Example

[C#]
    // The following example is for PersistentRangeField.

    public void PRField()
    {
        PersistentRangeField field =  new PersistentRangeField();
        // Apply your logic here.

    }

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

PersistentRangeField Members | TDevFramework Namespace


PersistentRangeField Members

PersistentRangeField overview

Public Instance Constructors

PersistentRangeField Overloaded. Initializes a new instance of the PersistentRangeField class.

Public Instance Properties

Dirty (inherited from PersistentField) | This is a read-only property that determines if the attribute represented by this PersistentField object has been set to a value and returns true, otherwise it returns false.
Name (inherited from PersistentField) | This is a read-only property that returns the name of the attribute represented by this PersistentField object.
Null (inherited from PersistentField) | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
ReadOnly (inherited from PersistentField) | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
Required (inherited from PersistentField) | This is a read-only property that determines if the target column associated with the attribute represented by this PersistentField object is required and returns true, otherwise it returns false for an optional attribute.
Type (inherited from PersistentField) | This is a read-only property that returns the .NET data type for the attribute represented by this PersistentField object. For a list of available data types, refer to EDataType enumeration in this document.
Value | This property lets the user change the value of the PersistentField object.

Public Instance Methods

Equals (inherited from Object) |
GetHashCode (inherited from Object) |
getMaxValue | This method returns the maximum range value that is associated with the PersistentRangeField attribute.
getMinValue | This method returns the minimum range value that is associated with the PersistentRangeField attribute.
GetType (inherited from Object) |
setRange | This method sets the minimum and maximum value for range criteria based on the values passed through minValue and maxValue parameters.
ToString (inherited from Object) |

Protected Instance Fields

_dataType (inherited from PersistentField) It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute. The list of available data types is shown below. Each data type corresponds to a .NET data type.

Protected Instance Methods

Finalize (inherited from Object)
MemberwiseClone (inherited from Object)

See Also

PersistentRangeField Class | TDevFramework Namespace


PersistentRangeField Constructor

This constructor instantiates the PersistentRangeField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

Overload List

Default constructor.

public PersistentRangeField();

This constructor instantiates the PersistentRangeField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentRangeField(string,bool,bool,EDataType);

This constructor instantiates the PersistentRangeField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentRangeField(string,bool,bool,EDataType,object);

This constructor additionally takes minimum and maximum values for the range criteria passed via minValue and maxValue parameter and associate it with the PersistentRangeField object.

public PersistentRangeField(string,bool,bool,EDataType,object,object);

This constructor additionally takes minimum and maximum values for the range criteria passed via minValue and maxValue parameter and associate it with the PersistentRangeField object.

public PersistentRangeField(string,bool,bool,EDataType,object,object,object);

See Also

PersistentRangeField Class | TDevFramework Namespace


PersistentRangeField Constructor (String, Boolean, Boolean, EDataType, Object)

This constructor instantiates the PersistentRangeField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentRangeField(
string name,
bool isRequired,
bool isReadOnly,
EDataType dataType,
object defaultVal
);

Parameters

name
Name of PersistentField.
isRequired
bool parameter.
isReadOnly
bool parameter for readonly objects.
dataType
EDataType parameter.
defaultVal
Specifies default value.

See Also

PersistentRangeField Class | TDevFramework Namespace | PersistentRangeField Constructor Overload List


PersistentRangeField Constructor (String, Boolean, Boolean, EDataType)

This constructor instantiates the PersistentRangeField and calls the base class constructor for initialization purpose. For details of the parameters, refer to PersistenField section in this document.

public PersistentRangeField(
string name,
bool isRequired,
bool isReadOnly,
EDataType dataType
);

Parameters

name
Name of PersistentField.
isRequired
bool parameter.
isReadOnly
bool parameter for readonly objects.
dataType
EDataType parameter.

See Also

PersistentRangeField Class | TDevFramework Namespace | PersistentRangeField Constructor Overload List


PersistentRangeField Constructor ()

Default constructor.

public PersistentRangeField();

See Also

PersistentRangeField Class | TDevFramework Namespace | PersistentRangeField Constructor Overload List


PersistentRangeField Constructor (String, Boolean, Boolean, EDataType, Object, Object, Object)

This constructor additionally takes minimum and maximum values for the range criteria passed via minValue and maxValue parameter and associate it with the PersistentRangeField object.

public PersistentRangeField(
string name,
bool isRequired,
bool isReadOnly,
EDataType dataType,
object defaultVal,
object minValue,
object maxValue
);

Parameters

name
Name of PersistentField.
isRequired
bool parameter.
isReadOnly
bool parameter for readonly objects.
dataType
EDataType parameter.
defaultVal
Specifies default value.
minValue
minValue for a PersistentField object.
maxValue
maxValue for a PersistentField object.

See Also

PersistentRangeField Class | TDevFramework Namespace | PersistentRangeField Constructor Overload List


PersistentRangeField Constructor (String, Boolean, Boolean, EDataType, Object, Object)

This constructor additionally takes minimum and maximum values for the range criteria passed via minValue and maxValue parameter and associate it with the PersistentRangeField object.

public PersistentRangeField(
string name,
bool isRequired,
bool isReadOnly,
EDataType dataType,
object minValue,
object maxValue
);

Parameters

name
Name of PersistentField.
isRequired
bool parameter.
isReadOnly
bool parameter for readonly objects.
dataType
EDataType parameter.
minValue
minValue for a PersistentField object.
maxValue
maxValue for a PersistentField object.

See Also

PersistentRangeField Class | TDevFramework Namespace | PersistentRangeField Constructor Overload List


PersistentRangeField Properties

The properties of the PersistentRangeField class are listed below. For a complete list of PersistentRangeField class members, see the PersistentRangeField Members topic.

Public Instance Properties

Dirty (inherited from PersistentField) | This is a read-only property that determines if the attribute represented by this PersistentField object has been set to a value and returns true, otherwise it returns false.
Name (inherited from PersistentField) | This is a read-only property that returns the name of the attribute represented by this PersistentField object.
Null (inherited from PersistentField) | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
ReadOnly (inherited from PersistentField) | This property determines if the attribute represented by this PersistentField object is Read-only and returns true, otherwise it returns false. It also lets the user change the value.
Required (inherited from PersistentField) | This is a read-only property that determines if the target column associated with the attribute represented by this PersistentField object is required and returns true, otherwise it returns false for an optional attribute.
Type (inherited from PersistentField) | This is a read-only property that returns the .NET data type for the attribute represented by this PersistentField object. For a list of available data types, refer to EDataType enumeration in this document.
Value | This property lets the user change the value of the PersistentField object.

See Also

PersistentRangeField Class | TDevFramework Namespace


Value Property

TierDeveloper Framework API

PersistentRangeField.Value Property

This property lets the user change the value of the PersistentField object.

public override object Value {get; set;}

See Also

PersistentRangeField Class | TDevFramework Namespace


PersistentRangeField Methods

The methods of the PersistentRangeField class are listed below. For a complete list of PersistentRangeField class members, see the PersistentRangeField Members topic.

Public Instance Methods

Equals (inherited from Object) |
GetHashCode (inherited from Object) |
getMaxValue | This method returns the maximum range value that is associated with the PersistentRangeField attribute.
getMinValue | This method returns the minimum range value that is associated with the PersistentRangeField attribute.
GetType (inherited from Object) |
setRange | This method sets the minimum and maximum value for range criteria based on the values passed through minValue and maxValue parameters.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object)
MemberwiseClone (inherited from Object)

See Also

PersistentRangeField Class | TDevFramework Namespace


PersistentRangeField.getMaxValue Method

This method returns the maximum range value that is associated with the PersistentRangeField attribute.

public object getMaxValue();

Return Value

object i.e. maximum range value.

Example

[C#]
    // The following get the maximum value for PersistentField.

    public void PRField()
    {
        PersistentRangeField field =  new PersistentRangeField();
        field.setRange(1,1000);

        field.getMaxValue();
        // Apply your logic here.

    }

See Also

PersistentRangeField Class | TDevFramework Namespace


PersistentRangeField.getMinValue Method

This method returns the minimum range value that is associated with the PersistentRangeField attribute.

public object getMinValue();

Return Value

object i.e. minimum range value.

Example

[C#]
    // The following get the minimum value for PersistentField.

    public void PRField()
    {
        PersistentRangeField field =  new PersistentRangeField();
        field.setRange(1,1000);

        field.getMinValue();
        // Apply your logic here.

    }

See Also

PersistentRangeField Class | TDevFramework Namespace


PersistentRangeField.setRange Method

This method sets the minimum and maximum value for range criteria based on the values passed through minValue and maxValue parameters.

public void setRange(
object minValue,
object maxValue
);

Parameters

minValue
minValue for a PersistentField object.
maxValue
maxValue for a PersistentField object.

Example

[C#]
    // The following sets the range for field.

    public void PRField()
    {
        PersistentRangeField field =  new PersistentRangeField();
        field.setRange(1,1000);
        // Apply your logic here.

    }

See Also

PersistentRangeField Class | TDevFramework Namespace


SqlCommand Class

This class is derived from TDevFramework “Command” class and provides the implementation for the .NET native Data Provider for SQL Server. The purpose of this class is to facilitate the construction of an SqlCommand object and its related objects that includes Parameter and DataSet.

For a list of all members of this type, see SqlCommand Members.

System.Object
TDevFramework.Command
TDevFramework.SqlCommand

public class SqlCommand : Command

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

[C#]

// The following example creates a SqlCommand using TDevFramework.SqlCommand class.

 public void UseSqlCommand(Course objInfo,string myConnectionString)
 {
    const String STD_UPDATE_SQL = @"UPDATE Course SET course_name = ? , credit_hours = ? WHERE course_id = ?";
    bool USE_STORE_PROC =  false;

   // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection

    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());
    myCommand.Prepare(STD_UPDATE_SQL, USE_STORE_PROC);
    myConnection.BeginTransaction();

    // Now add parameter to your myCommand object e.g.
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
    myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

    myCommand.ExecuteNonQuery();

    myConnection.SetStatus();
    // Always close your  connection.
    myConnection.CloseConnection();

  }

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

SqlCommand Members | TDevFramework Namespace


SqlCommand Members

SqlCommand overview

Public Instance Constructors

SqlCommand Constructor This is the constructor for SqlCommand class and it constructs the SqlCommand object based on the associated SqlConnection object passed via connection parameter.

Public Instance Properties

Transaction Gets or sets the current transaction.

Public Instance Methods

AddParameter | Overloaded. This method adds the parameter to command.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around DataReader.GetBytes method.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getParameterValue | This method returns the value for the specified parameter from the parameters collection associated with the Command object.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
IsNull | Overloaded. This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
Prepare | This method constructs the.NET Data Provider specific Command object.
PrepareNew | This method creates a new .NET Data Provider specific Command object if it not created.
ProcessDataSet | Overloaded. This feature is not supported in TierDeveloper 5.0
Read | This is a wrapper method and makes call to the Read method of SqlDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReadBytes | This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.
Release | This method closes the DataReader object associated with the Command object and disposes the Command object.
ReleaseReader | This method release the DataReader object associated with the SqlCommand object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
getParamDirection (inherited from Command) | Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet
MemberwiseClone (inherited from Object) |

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand Constructor

This is the constructor for SqlCommand class and it constructs the SqlCommand object based on the associated SqlConnection object passed via connection parameter.

public SqlCommand(
SqlConnection connection
);

Parameters

connection
Connection class object.

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand Properties

The properties of the SqlCommand class are listed below. For a complete list of SqlCommand class members, see the SqlCommand Members topic.

Public Instance Properties

Transaction Gets or sets the current transaction.

See Also

SqlCommand Class | TDevFramework Namespace


Transaction Property

TierDeveloper Framework API

SqlCommand.Transaction Property

Gets or sets the current transaction.

public override object Transaction {get; set;}

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand Methods

The methods of the SqlCommand class are listed below. For a complete list of SqlCommand class members, see the SqlCommand Members topic.

Public Instance Methods

AddParameter | Overloaded. This method adds the parameter to command.
Equals (inherited from Object) |
ExecuteNonQuery | Executes a Transact-SQL statement against the connection and returns the number of rows affected.
ExecuteReader | Executes commands that return rows.
ExecuteScalar | Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
getBytes | This method is a wrapper around DataReader.GetBytes method.
getByteSize | This method returns total number of bytes in the target binary attribute.
GetDataSet | This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
getFieldCount | This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.
getFieldName | This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.
GetHashCode (inherited from Object) |
getParameterValue | This method returns the value for the specified parameter from the parameters collection associated with the Command object.
GetType (inherited from Object) |
getValue | Overloaded. This method returns the value of the specific column in the current row.
IsNull | Overloaded. This method determines if the specific column value is NULL and returns true. Otherwise it returns false.
PopulateDataSet | This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.
Prepare | This method constructs the.NET Data Provider specific Command object.
PrepareNew | This method creates a new .NET Data Provider specific Command object if it not created.
ProcessDataSet | Overloaded. This feature is not supported in TierDeveloper 5.0
Read | This is a wrapper method and makes call to the Read method of SqlDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.
ReadBytes | This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.
Release | This method closes the DataReader object associated with the Command object and disposes the Command object.
ReleaseReader | This method release the DataReader object associated with the SqlCommand object.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
getParamDirection (inherited from Command) | Specifies and returns the type of a parameter within a query relative to the System.Data.DataSet
MemberwiseClone (inherited from Object) |

See Also

SqlCommand Class | TDevFramework Namespace


AddParameter Method

TierDeveloper Framework API

SqlCommand.AddParameter Method

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

Overload List

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,bool);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,int);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,object,EParamDirection,int,bool);

This method adds the parameter to command.

public override void AddParameter(string,EDataType,EParamDirection);

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(string,EDataType,EParamDirection,int);

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.AddParameter Method (String, EDataType, Object, EParamDirection)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput);

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.AddParameter Overload List


SqlCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Boolean)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
bool bNull
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
bNull
Determine whether value is null or not.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.AddParameter Overload List


SqlCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Int32)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, size );
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, size );

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.AddParameter Overload List


SqlCommand.AddParameter Method (String, EDataType, Object, EParamDirection, Int32, Boolean)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
object paramValue,
EParamDirection direction,
int size,
bool bNull
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
paramValue
Value of the object attribute e.g. objInfo.firstName.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size
bNull
Determine whether value is null or not.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, size ,objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, size ,objInfo.IsNull("credit_hours"));

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.AddParameter Overload List


SqlCommand.AddParameter Method (String, EDataType, EParamDirection)

This method adds the parameter to command.

public override void AddParameter(
string name,
EDataType eType,
EParamDirection direction
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar,  TDevFramework.EParamDirection.eInput);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt,  TDevFramework.EParamDirection.eInput);

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.AddParameter Overload List


SqlCommand.AddParameter Method (String, EDataType, EParamDirection, Int32)

This method constructs the Parameter object and adds it in the Parameters collection. The eType parameter represents the data type and direction corresponds to the parameter direction. For the available values in the EDataType and EParamDirection, refer to EDataType and EParamDirection sections.

public override void AddParameter(
string name,
EDataType eType,
EParamDirection direction,
int size
);

Parameters

name
Name of the column field. e.g firstname
eType
It is used to specify the data type for an attribute. When a PersistentField object is created, EDataType value specifies the target .NET data type for the associated attribute.
direction
It is used to specify the parameter direction for a Parameter object. This is basically a wrapper around System.Data.Parameter enumeration.
size
Determine its size

Example

[C#]

// The following demonstrates the use of AddParameter method.

 public void UseAddParameter(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());
    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    myConnection.BeginTransaction();
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, size);
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, size );

    myCommand.ExecuteReader();
    if (myCommand.Read ())
    {
        if (! myCommand.IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
    }
    myCommand.ReleaseReader();
    myConnection.SetStatus(EStatus.eSuccess);
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.AddParameter Overload List


SqlCommand.ExecuteNonQuery Method

Executes a Transact-SQL statement against the connection and returns the number of rows affected.

public override int ExecuteNonQuery();

Return Value

number of rows affected

Example

[C#]

// The following example demonstrates the use of ExecuteNonQuery method.

 public void UseExecuteNonQuery(Course objInfo,string myConnectionString)
 {
    const String STD_UPDATE_SQL = "spCourseUpdate";
    bool USE_STORE_PROC =  true;

   // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.OracleConnection(myConnectionString);
    // open the connection

    myConnection.OpenConnection();

    Command myCommand = new TDevFramework.OracleCommand((System.Data.OracleClient.OracleConnection)myConnection.getConnection());
    myCommand.Prepare(STD_UPDATE_SQL, USE_STORE_PROC);
    myConnection.BeginTransaction();

    // Now add parameter to your myCommand object e.g.
    myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
    myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));
    myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

    myCommand.ExecuteNonQuery();

    myConnection.SetStatus();
    // Always close your  connection.
    myConnection.CloseConnection();

  }

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.ExecuteReader Method

Executes commands that return rows.

public override void ExecuteReader();

Example

[C#]

//  The following example will demonstrate the use of ExecuteReader method.

    public void Load(Course objInfo ,string myConnectionString)
    {
        const String STD_LOAD_SQL = @"SELECT t2.course_id course_id , t2.course_name course_name , t2.credit_hours credit_hours FROM Course t2 WHERE t2.course_id = ?";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());
        myCommand.Prepare(STD_LOAD_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_id", TDevFramework.EDataType.eInt, objInfo.course_id, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_id"));

        myCommand.ExecuteReader();

        while(myCommand.Read())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(myCommand.getValue("course_id"));
            if (!IsNull("course_name")) objInfo.course_name = Convert.ToString(myCommand.getValue("course_name"));
            if (!IsNull("credit_hours")) objInfo.credit_hours = Convert.ToInt32(myCommand.getValue("credit_hours"));
            objInfo.IsNew = false;
            objInfo.Dirty = false;
        }

        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.ExecuteScalar Method

Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.

public override object ExecuteScalar();

Return Value

object i.e returns the first column of the first row.

Example

[C#]

//  The following example will demonstrate the use of ExecuteScalar function.

public Int32 FindByStudentCount( Int32 n32prmstudent_id, string myConnectionString)
{
    const String FindByStudent_SQL = @"SELECT t1.course_id course_id, t1.course_name course_name,t1.credit_hours credit_hours FROM Course t1 INNER JOIN  CourseTaken a1 ON t1.course_id = a1.course_id WHERE (a1.student_id = ?)";
    Int32 recordCount = 0;
    try
    {
        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());

        objInfo.ValidateRequiredFields();
        myCommand.Prepare(FindByStudentCount_SQL, false);
        test.BeginTransaction();
        myCommand.AddParameter("@prmstudent_id", TDevFramework.EDataType.eInt, n32prmstudent_id, EParamDirection.eInput);

        recordCount = Convert.ToInt32(myCommand.ExecuteScalar());
        myCommand.SetStatus(EStatus.eSuccess);
        myCommand.ReleaseCommand();
    }
    catch (Exception e)
    {
        test.SetStatus(EStatus.eFail);
        test.ReleaseCommand();
    }
    return recordCount;
}

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.getBytes Method

This method is a wrapper around DataReader.GetBytes method.

public override byte[] getBytes(
string columnName
);

Parameters

columnName

Return Value

Returns array of bytes.

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.getByteSize Method

This method returns total number of bytes in the target binary attribute.

public override long getByteSize(
string columnName
);

Parameters

columnName

Return Value

long.

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.GetDataSet Method

This method constructs a DataSet object and then fills it with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.

public override DataSet GetDataSet(
string tableName
);

Return Value

DataSet object

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.getFieldCount Method

This is wrapper around FieldCount property of OleDbDataReader and returns number of columns in the current row.

public override int getFieldCount();

Return Value

int

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.getFieldName Method

This is wrapper around GetName method of OleDbDataReader and returns name of the column at the specified index. The index is a zero-based ordinal value.

public override string getFieldName(
int index
);

Parameters

index

Return Value

string i.e. The name of the specified column.

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.getParameterValue Method

This method returns the value for the specified parameter from the parameters collection associated with the Command object.

public override object getParameterValue(
string parameterName
);

Parameters

parameterName
Specified parameter from the parameters collection associated with the Command object.

Return Value

object i.e. value for the specified parameter.

See Also

SqlCommand Class | TDevFramework Namespace


getValue Method

TierDeveloper Framework API

SqlCommand.getValue Method

This method returns the value of the specific column in the current row.

Overload List

This method returns the value of the specific column in the current row.

public override object getValue(int);

This method returns the value of the specific column in the current row.

public override object getValue(string);

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.getValue Method (Int32)

This method returns the value of the specific column in the current row.

public override object getValue(
int colIndex
);

Parameters

colIndex
Specify index of the column.

Return Value

Returns an object.i.e Value of the specific column.

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.getValue Overload List


SqlCommand.getValue Method (String)

This method returns the value of the specific column in the current row.

public override object getValue(
string columnName
);

Parameters

columnName
Name of column of a table

Return Value

Returns an object.i.e Value of the specific column.

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.getValue Overload List


IsNull Method

TierDeveloper Framework API

SqlCommand.IsNull Method

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

Overload List

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(int);

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(string);

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.IsNull Method (Int32)

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(
int colIndex
);

Parameters

colIndex
Index of the column.

Return Value

Returns bool value either true or false.

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.IsNull Overload List


SqlCommand.IsNull Method (String)

This method determines if the specific column value is NULL and returns true. Otherwise it returns false.

public override bool IsNull(
string columnName
);

Parameters

columnName
Name of the column of a specific table.

Return Value

Returns bool value either true or false.

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.IsNull Overload List


SqlCommand.PopulateDataSet Method

This method fills the DataSet object parameter with the schema data for the specific SQL command. It calls OleDbDataAdapter Fill method to populate the DataSet object.

public override void PopulateDataSet(
string dataTableName,
ref DataSet dataSet
);

Parameters

dataTableName
Name of the table.
dataSet
Pass DataSet object by reference.

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.Prepare Method

This method constructs the.NET Data Provider specific Command object.

public override void Prepare(
string commandString,
bool isStoredProc
);

Parameters

commandString
Used to specify the command query.
isStoredProc
Boolean variable to specify whether command is to be created for Stored Procedure or not.

Example

[C#]

// The following demonstrates the use of Prepare method.

 public void UsePrepare(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());

    myCommand.Prepare(STD_INSERT_SQL, USE_STORE_PROC);

    // Apply your own logic here

    myConnection.CloseConnection();
}

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.PrepareNew Method

This method creates a new .NET Data Provider specific Command object if it not created.

public override void PrepareNew(
string commandString,
bool isStoredProc
);

Parameters

commandString
Used to specify the command.
isStoredProc
Boolean variable to specify whether command is to be created for Stored Procedure or not.

Example

[C#]

// The following demonstrates the use of PrepareNew method.

 public void UsePrepareNew(Course objInfo,string myConnectionString)
 {
    const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name, credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";
    const bool USE_STORE_PROC = false;

    // If the connection string is null, use a default
    if(myConnectionString == "")
    {
         myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();
    Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());

    myCommand.PrepareNew(STD_INSERT_SQL, USE_STORE_PROC);

    // Apply your own logic here

    myConnection.CloseConnection();
}

See Also

SqlCommand Class | TDevFramework Namespace


ProcessDataSet Method

TierDeveloper Framework API

SqlCommand.ProcessDataSet Method

Overload List

public override void ProcessDataSet(DataSet);

This feature is not supported in TierDeveloper 5.0

public override void ProcessDataSet(string,DataSet);

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.ProcessDataSet Method (DataSet)

public override void ProcessDataSet(
DataSet dataSet
);

Parameters

dataSet

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.ProcessDataSet Overload List


SqlCommand.ProcessDataSet Method (String, DataSet)

This feature is not supported in TierDeveloper 5.0

public override void ProcessDataSet(
string dataTableName,
DataSet dataSet
);

Parameters

dataTableName
dataSet

See Also

SqlCommand Class | TDevFramework Namespace | SqlCommand.ProcessDataSet Overload List


SqlCommand.Read Method

This is a wrapper method and makes call to the Read method of SqlDataReader object associated with the Command object. It advances the pointer to the next record in the rowset and returns true. If there are no more rows, it returns false.

public override bool Read();

Return Value

Returns bool value either true or false.

Example

[C#]

//  The following example will demonstrate the use of Read method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        // Read method
        if (myCommand.Read ())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.ReadBytes Method

This is a wrapper method around GetBytes method of OleDbDataReader and reads the byte stream for the specified column into the buffer parameter.

public override void ReadBytes(
string columnName,
long dataIndex,
byte[] buffer,
int buffIndex,
int length
);

Parameters

columnName
dataIndex
buffer
buffIndex
length

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.Release Method

This method closes the DataReader object associated with the Command object and disposes the Command object.

public override void Release();

See Also

SqlCommand Class | TDevFramework Namespace


SqlCommand.ReleaseReader Method

This method release the DataReader object associated with the SqlCommand object.

public override void ReleaseReader();

See Also

SqlCommand Class | TDevFramework Namespace


SqlConnection Class

This is a derivation of the TDevFramework “Connection” class and provides the implementation for the .NET native Data Provider for SQL Server. The purpose of this class is to facilitate the construction of an SqlConnection object.

For a list of all members of this type, see SqlConnection Members.

System.Object
TDevFramework.Connection
TDevFramework.SqlConnection

public class SqlConnection : Connection

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

[C#]

// The following example creates a SqlConnection using TDevFramework.SqlConnection class.

 public void CreateConnection(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    SqlConnection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

Requirements

Namespace: TDevFramework

Assembly: EnterpriseNonServicedLib (in EnterpriseNonServicedLib.dll)

See Also

SqlConnection Members | TDevFramework Namespace


SqlConnection Members

SqlConnection overview

Public Instance Constructors

SqlConnection Overloaded. Initializes a new instance of the SqlConnection class.

Public Instance Properties

Transaction Gets the current transaction.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
CloseConnection | This method closes the currently opened connection and sets the IsOpen flag to false.
CreateCommand | This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.
Equals (inherited from Object) |
getConnection | Gets the connection object.
getConnectionString (inherited from Connection) | Gets the connection string.
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IsManualTransaction (inherited from Connection) | Determines whether transaction is manual or not.
IsOpen (inherited from Connection) | Determines whether connection is open or not and return true or false accordingly.
OpenConnection | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
OpenConnection (inherited from Connection) | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
SetAbort | This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.
SetManualTransaction (inherited from Connection) | This method sets the transaction as manual.
SetStatus | This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.
ToString (inherited from Object) |

Protected Instance Fields

_connectionString (inherited from Connection) | Used to specify the connectin string.
_isManualTransaction (inherited from Connection) | Used to see whether transaction is manually started or not.
_isOpen (inherited from Connection) | Used to see whether connectin is open or close.

Protected Instance Methods

Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
setOpen (inherited from Connection) | This method sets the _isOpen property to true or false.

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection Constructor

This is the constructor for SqlConnection class and it constructs the SqlConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

Overload List

This is the constructor for SqlConnection class and it constructs the SqlConnection object.

public SqlConnection(object);

This is the constructor for SqlConnection class and it constructs the SqlConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

public SqlConnection(string);

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection Constructor (String)

This is the constructor for SqlConnection class and it constructs the SqlConnection object and calls the base class constructor to set the connection string passed via connectionString parameter.

public SqlConnection(
string connectionString
);

Parameters

connectionString

See Also

SqlConnection Class | TDevFramework Namespace | SqlConnection Constructor Overload List


SqlConnection Constructor (Object)

This is the constructor for SqlConnection class and it constructs the SqlConnection object.

public SqlConnection(
object connection
);

Parameters

connection

See Also

SqlConnection Class | TDevFramework Namespace | SqlConnection Constructor Overload List


SqlConnection Properties

The properties of the SqlConnection class are listed below. For a complete list of SqlConnection class members, see the SqlConnection Members topic.

Public Instance Properties

Transaction Gets the current transaction.

See Also

SqlConnection Class | TDevFramework Namespace


Transaction Property

TierDeveloper Framework API

SqlConnection.Transaction Property

Gets the current transaction.

public override object Transaction {get;}

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection Methods

The methods of the SqlConnection class are listed below. For a complete list of SqlConnection class members, see the SqlConnection Members topic.

Public Instance Methods

BeginTransaction | Overloaded. Starts the transaction.
CloseConnection | This method closes the currently opened connection and sets the IsOpen flag to false.
CreateCommand | This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.
Equals (inherited from Object) |
getConnection | Gets the connection object.
getConnectionString (inherited from Connection) | Gets the connection string.
GetHashCode (inherited from Object) |
GetType (inherited from Object) |
IsManualTransaction (inherited from Connection) | Determines whether transaction is manual or not.
IsOpen (inherited from Connection) | Determines whether connection is open or not and return true or false accordingly.
OpenConnection | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
OpenConnection (inherited from Connection) | Overloaded. Opens a database connection with the property settings specified by the ConnectionString
SetAbort | This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.
SetComplete | This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.
SetManualTransaction (inherited from Connection) | This method sets the transaction as manual.
SetStatus | This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.
ToString (inherited from Object) |

Protected Instance Methods

Finalize (inherited from Object) |
MemberwiseClone (inherited from Object) |
setOpen (inherited from Connection) | This method sets the _isOpen property to true or false.

See Also

SqlConnection Class | TDevFramework Namespace


BeginTransaction Method

TierDeveloper Framework API

SqlConnection.BeginTransaction Method

Starts the transaction.

Overload List

Starts the transaction.

public override object BeginTransaction();

Starts the transaction.

public override object BeginTransaction(IsolationLevel);

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection.BeginTransaction Method ()

Starts the transaction.

public override object BeginTransaction();

Return Value

object

Example

[C#]

//  The following example will demonstrate the use of SetStatus method.

    public void Insert(Course objInfo ,string myConnString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);

        // Start the transaction.
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();

        // Call this method to set status of transaction.
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

SqlConnection Class | TDevFramework Namespace | SqlConnection.BeginTransaction Overload List


SqlConnection.BeginTransaction Method (IsolationLevel)

Starts the transaction.

public override object BeginTransaction(
IsolationLevel isolationLevel
);

Parameters

isolationLevel
The IsolationLevel values are used by a .NET Framework data provider when performing a transaction.

Return Value

object

See Also

SqlConnection Class | TDevFramework Namespace | SqlConnection.BeginTransaction Overload List


SqlConnection.CloseConnection Method

This method closes the currently opened connection and sets the IsOpen flag to false.

public override void CloseConnection();

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection.CreateCommand Method

This method creates the .NET Data Provider specific Command object and associates it with the Connection object. It returns the created .NET Data Provider specific Command object.

public override Command CreateCommand(
string commandString,
bool isStoredProc
);

Parameters

commandString
isStoredProc
bool value

Return Value

Command object

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

[C#]

// The following example demonstrates the use of CreateCommand method.

 public void CreateCommand(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    string mySelectQuery = "SELECT EmpNo, DeptNo FROM Emp";
    SqlConnection myConnection = new TDevFramework.SqlConnection(myConnectionString);
    myConnection.OpenConnection();

    // Create a new Command
    Command myCommand = myConnection.CreateCommand(mySelectQuery,false);

    // Apply your own logic here.

    myConnection.CloseConnection();

  }

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection.getConnection Method

Gets the connection object.

public override object getConnection();

Return Value

Return connection object

Example

[C#]

// The following example demonstrates the use of getConnection method.

 public void CreateConnection(Connection myConnection, string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }

    // Now connection contains the object returned by the getConnection method.
    SqlConnection connection = (SqlConnection) myConnection.getConnection();

    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

See Also

SqlConnection Class | TDevFramework Namespace


OpenConnection Method

TierDeveloper Framework API

SqlConnection.OpenConnection Method

Opens a database connection with the property settings specified by the ConnectionString

Overload List

Inherited from Connection.

public object OpenConnection();

Opens a database connection with the property settings specified by the ConnectionString

public override object OpenConnection(string);

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection.OpenConnection Method (String)

Opens a database connection with the property settings specified by the ConnectionString

public override object OpenConnection(
string connectionString
);

Parameters

connectionString
String that contains the connection string for the database.

Example

connectionString ="Data Source=localhost;Database=tdevstore;User Id=sa;Password=;"

[C#]

// The following example demonstrates the use of OpenConnection method.

 public void CreateConnection(string myConnectionString)
 {
 // If the connection string is null, use a default.
    if(myConnectionString == "")
    {
        myConnectionString = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
    }
    SqlConnection myConnection = new TDevFramework.SqlConnection(myConnectionString);

    // open the connection
    myConnection.OpenConnection();

    // Apply rest of your logic here

    // Always close your connection.
    myConnection.CloseConnection();

  }

See Also

SqlConnection Class | TDevFramework Namespace | SqlConnection.OpenConnection Overload List


SqlConnection.SetAbort Method

This method is called as part of the Transaction and makes call to ContextUtil.SetAbort() method.

public override void SetAbort();

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection.SetComplete Method

This method is called as part of the Transaction and makes call to ContextUtil. SetComplete() method.

public override void SetComplete();

See Also

SqlConnection Class | TDevFramework Namespace


SqlConnection.SetStatus Method

This method causes the current transaction to complete or abort based on the EStatus value passed through parameter eStatus.If eStatus is eSuccess, the method makes call to SetComplete otherwise it calls SetAbort that causes the transaction to abort.

public override void SetStatus(
EStatus eStatus
);

Parameters

eStatus
It represents the status for a transaction and is used in SetStatus method of TDevFramework Connection class that causes the transaction to complete or abort based on this value.

Example

[C#]

//  The following example will demonstrate the use of SetStatus method.

    public void Insert(Course objInfo ,string myConnectionString)
    {
        const String STD_INSERT_SQL = @"INSERT INTO  Course (course_name,credit_hours) VALUES (?, ?) ; SELECT SCOPE_IDENTITY() AS course_id";

        if(myConnectionString == "")
        {
             myConnectionString  = "Data Source=localhost;Database=tdevstore;User Id=sa;Password=;";
        }
        Connection myConnection = new TDevFramework.SqlConnection(myConnectionString);
        // open the connection

        myConnection.OpenConnection();
        Command myCommand = new TDevFramework.SqlCommand((System.Data.SqlClient.SqlConnection)myConnection.getConnection());

        // Now add parameter to your myCommand object e.g.
        objInfo.ValidateRequiredFields();
        myCommand.Prepare(STD_INSERT_SQL, false);
        myConnection.BeginTransaction();
        myCommand.AddParameter("@course_name", TDevFramework.EDataType.eVarchar, objInfo.course_name, TDevFramework.EParamDirection.eInput, objInfo.IsNull("course_name"));
        myCommand.AddParameter("@credit_hours", TDevFramework.EDataType.eInt, objInfo.credit_hours, TDevFramework.EParamDirection.eInput, objInfo.IsNull("credit_hours"));

        myCommand.ExecuteReader();

        if (myCommand.Read ())
        {
            if (!IsNull("course_id")) objInfo.course_id = Convert.ToInt32(getValue("course_id"));
        }
        myCommand.ReleaseReader();

        // Call this method to set status of transaction.
        myConnection.SetStatus(EStatus.eSuccess);
        myConnection.CloseConnection();
    }

See Also

SqlConnection Class | TDevFramework Namespace


TDevFrameworkHierarchy

TierDeveloper Framework API

TDevFramework Hierarchy

System.Object
System.Collections.CollectionBase ---- System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
TDevFramework.Collection
System.ValueType
System.Enum ---- System.IComparable, System.IConvertible, System.IFormattable
TDevFramework.EDataType
TDevFramework.EDBProvider
TDevFramework.EParamDirection
TDevFramework.EStatus
TDevFramework.Command
TDevFramework.OleDbCommand
TDevFramework.OracleCommand
TDevFramework.SqlCommand
TDevFramework.ConfigurationSettings
TDevFramework.Connection
TDevFramework.OleDbConnection
TDevFramework.OracleConnection
TDevFramework.SqlConnection
TDevFramework.DbObject
TDevFramework.PersistentField
TDevFramework.PersistentMembershipField
TDevFramework.PersistentRangeField
TDevFramework.PersistentObject

See Also

TDevFramework Namespace