QuickObjects.DBLibrary Send comments on this topic.
DatabaseObject Class Members
See Also  Properties  Methods 
Akal.QuickObjects.DBLibrary Namespace : DatabaseObject Class


The following tables list the members exposed by DatabaseObject.

Public Constructors

 NameDescription
Public ConstructorDatabaseObject ConstructorOverloaded. DatabaseObject

Default constructor for this class.  

Top

Public Properties

 NameDescription
Public PropertyAffectedRecords

AffectedRecords

Holds an Int32 value which can be used to hold the number of records that are either returned or affected by a query.

This can be very useful in cases where a count of returned rows is needed.


myLabel.Text = myBusinessObject.AffectedRecords.ToString() + " records were returned by your search";
 
Public PropertyConnectionString

ConnectionString

Holds the value for connection String used to make a connection to the target database.

This property is automatically initialized with the value from the application configuration settings. The value of ConnectionStringConfigName is used to look for the connection String from the application settings (AppSettings/Keys in Framework 1.1 and ConnectionSettings/Connections in Framework 2.0)..

This property can also be manually set to point the library to a database other than the default. This will be useful if you need the library to connect to multiple database.


myBusinessObj.ConnectionString = "Server=.\SQLExpress;Database=SqlSample;User ID=my_id;Password=my_pass;User Instance=false;
 
Public PropertyConnectionStringConfigNameConnectionStringConfigName

Set this property to change the name of the connection String. By default the library looks for a "database" connection String (AppSettings/Keys in Framework 1.1 and ConnectionStrings in Framework 2.0). This property should be modified before the database connection is initiated.  

Public PropertyDatabaseTypeConfigNameDatabaseTypeConfigName

Set this property to change the name of the AppSettings key that contains the database type information. By default the library looks for a "database_type" AppSettings key.  

Public PropertyDBTypeDBType

Specifies the uderlying database server that will be used by this library.  

Public PropertyErrorString

ErrorString

Holds a String value. This value is used to store the errors that were encountered while working with any of the database objects.


myErrLabel.Text = this.ErrorString;
 
Top

Public Methods

 NameDescription
Public MethodSetDatabaseType

SetDatabaseType

Takes a String as the parameter and sets the DBType property with the type of database to which this object will be connecting.

Parameters:
Description
dBType

Sets the DBType property value with the value passed in.

Possible values for passing to this method are:

SqlServer2000

SqlServer2005

Oracle8i

Oracle9i

Oracle10g


myBusinessObj.SetDatabaseType("SqlServer2005");
 
Top

Protected Methods

 NameDescription
Protected MethodEnsureConnectionStringEnsureConnectionString

Checks the ConnectionString property and if it is nont set, it will try to get the Configuration / AppSettings / key (1.1 Framework) or Configuration / ConnectionStrings / key (2.0 Framework) that defines the database connection String.

Calling this method is not needed in normal scenarios. This will be needed only if you are changing the ConnectionStringConfigName property through the code and would want to ensure that the new value is loaded from the configuration file and the ConnectionString property is updated accordingly.

If you are calling EnsureDatabaseType method as well then you don't need to do that as EnsureDatabaseType is called by the EnsureConnectionString.  

Protected MethodEnsureDatabaseTypeEnsureDatabaseType

Checks the DBType property and if it is set to None, it will try to get the Configuration / AppSettings / key that defines the DBType.

Calling this method is not needed in normal scenarios. This will be needed only if you are changing the DatabaseTypeConfigName property through the code and would want to ensure that the new value is loaded from the configuration file and the DBType property is updated accordingly.

If you are calling EnsureConnectionString method as well then you don't need to call EnsureDatabaseType as it is called by the EnsureConnectionString.  

Top

See Also