Click or drag to resize

DbDatabase Class

The SqlDatabase class contains the core functionality of establishing a connection with an SQL Server database and executing simple stored procedures. USAGE - Create a class which derives from this, and specify a Provider. I.E public bool IsUser(string userName, string password) { Provider = connectionString.ProviderName; string queryText = string.Format("select * from users where UserID = {0} and password = {1}",GetDBParameterString("UserId"),GetDBParameterString("Password")); DbParameter[] parameters = { GetParameter("UserId",userName), GetParameter("Password",password) }; parameters[0].Value = userName; parameters[1].Value = password; DbResultSet resultSet = RunQuery(ConnectionString.ConnectionString, queryText, parameters); bool isUser = resultSet.HasRows; resultSet.Close(); return isUser; } The DbResultSet class can be used to iterate through returned data quite nicely : i.e. DbResultSet resultSet = RunQuery(ConnectionString.ConnectionString, queryText, parameters); while(resultset.Next(){ string returnedValue = resultSet.GetString("ReturnedFieldName"); } resultSet.Close(); More functionality for the DbResultSet is explained in the DbResultSet file, and the ResultSet file.
Inheritance Hierarchy
SystemObject
  Cadcorp.DataAccessDbDatabase
    More...

Namespace:  Cadcorp.DataAccess
Assembly:  Cadcorp.GFB.DataAccess (in Cadcorp.GFB.DataAccess.dll) Version: 9.0.2618.0 (9.0.2618.0)
Syntax
public abstract class DbDatabase

The DbDatabase type exposes the following members.

Constructors
  NameDescription
Public methodDbDatabase
Initializes a new instance of the DbDatabase class
Top
Methods
  NameDescription
Protected methodCreateReturnParameter
Adds a return parameter to non query.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Protected methodGetAdapter
Protected methodGetDbCommand
Creates a new command object.
Public methodGetDbConnection
Creates a new connection object.
Protected methodGetDbDataAdapter
Creates a new adapter object.
Public methodGetDBParameterString
Returns the correct parameter string for the database platform in use.
Public methodGetDBUppercaseFunction
Returns the correct parameter string for the database platform in use.
Public methodGetDBWildcardString
Returns the correct parameter string for the database platform in use.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetParameter(String, Object, String)
Returns a new parameter.
Public methodGetParameter(String, Object, String, Boolean)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodRunProcedure(String, String, IDataParameter, String)
Runs a stored procedure, returning an SqlResultSet containing the result of the stored procedure.
Protected methodRunProcedure(DbConnection, String, IDataParameter, Int32, String)
Runs a stored procedure, returning an integer indicating the return value of the stored procedure. Also returns the value of the RowsAffected aspect of the stored procedure that is returned by the ExecuteNonQuery method.
Protected methodRunProcedure(DbConnection, String, String, IDataParameter, String)
Runs a stored procedure, returning an SqlResultSet containing the result of the stored procedure.
Protected methodRunProcedure(String, String, IDataParameter, Int32, String)
Runs a stored procedure, returning an integer indicating the return value of the stored procedure. Also returns the value of the RowsAffected aspect of the stored procedure that is returned by the ExecuteNonQuery method.
Protected methodRunProcedure(String, String, IDataParameter, String, String)
Runs a stored procedure, returning a DataSet that contains the results of the stored procedure in a named table.
Protected methodRunProcedure(String, String, IDataParameter, String, String)
Runs a stored procedure, returning an ArrayList containing the specified fields from the result of the stored procedure. N.B. This method has been retained for backward compatibility. It is recommended that a strongly typed generic list is used instead of an ArrayList.
Protected methodRunProcedure(DbConnection, String, String, IDataParameter, String, String)
Runs a stored procedure, returning a DataSet that contains the results of the stored procedure in a named table.
Protected methodRunProcedure(DbConnection, String, String, IDataParameter, String, String)
Runs a stored procedure, returning an ArrayList containing the specified fields from the result of the stored procedure. N.B. This method has been retained for backward compatibility. It is recommended that a strongly typed generic list is used instead of an ArrayList.
Protected methodRunProcedure(String, String, IDataParameter, DataSet, String, String)
Takes an existing DataSet and fills the given table name with the results of the stored procedure.
Protected methodRunProcedure(String, String, IDataParameter, Int32, Int32, String)
Returns a populated DataTable from the stored procedure provided.
Protected methodRunProcedure(String, String, IDataParameter, String, String, String)
Runs a stored procedure, returning a DataView that contains the results of the stored procedure in a named table within a DataSet.
Protected methodRunProcedure(DbConnection, String, String, IDataParameter, DataSet, String, String)
Takes an existing DataSet and fills the given table name with the results of the stored procedure.
Protected methodRunProcedure(DbConnection, String, String, IDataParameter, Int32, Int32, String)
Returns a populated DataTable from the stored procedure provided.
Protected methodRunProcedure(DbConnection, String, String, IDataParameter, String, String, String)
Runs a stored procedure, returning a DataView that contains the results of the stored procedure in a named table within a DataSet.
Protected methodRunQuery(String, String, IDataParameter, String)
Runs a query, returning an SqlResultSet containing the result of the query.
Protected methodRunQuery(DbConnection, String, IDataParameter, Int32, String)
Runs a query, returning an integer indicating the return value of the stored procedure. Also returns the value of the RowsAffected aspect of the stored procedure that is returned by the ExecuteNonQuery method.
Protected methodRunQuery(DbConnection, String, String, IDataParameter, String)
Runs a query, returning an SqlResultSet containing the result of the query.
Protected methodRunQuery(String, String, IDataParameter, DataTable, String)
Takes an existing DataTable and fills it with the results of the query.
Protected methodRunQuery(String, String, IDataParameter, Int32, String)
Runs a query, returning an integer indicating the return value of the stored procedure. Also returns the value of the RowsAffected aspect of the stored procedure that is returned by the ExecuteNonQuery method.
Protected methodRunQuery(String, String, IDataParameter, String, String)
Runs a query, returning a DataSet that contains the results of the query in a named table.
Protected methodRunQuery(String, String, IDataParameter, String, String)
Runs a stored procedure, returning an ArrayList containing the specified fields from the result of the query. N.B. This method has been retained for backward compatibility. It is recommended that a strongly typed generic list is used instead of an ArrayList.
Protected methodRunQuery(DbConnection, String, String, IDataParameter, DataTable, String)
Takes an existing DataTable and fills it with the results of the query.
Protected methodRunQuery(DbConnection, String, String, IDataParameter, String, String)
Runs a query, returning a DataSet that contains the results of the query in a named table.
Protected methodRunQuery(DbConnection, String, String, IDataParameter, String, String)
Runs a stored procedure, returning an ArrayList containing the specified fields from the result of the query. N.B. This method has been retained for backward compatibility. It is recommended that a strongly typed generic list is used instead of an ArrayList.
Protected methodRunQuery(String, String, IDataParameter, DataSet, String, String)
Takes an existing DataSet and fills the given table name with the results of the query.
Protected methodRunQuery(String, String, IDataParameter, Int32, Int32, String)
Returns a populated DataTable from the query provided.
Protected methodRunQuery(String, String, IDataParameter, String, String, String)
Runs a query, returning a DataView that contains the results of the query in a named table within a DataSet.
Protected methodRunQuery(DbConnection, String, String, IDataParameter, DataSet, String, String)
Takes an existing DataSet and fills the given table name with the results of the query.
Protected methodRunQuery(DbConnection, String, String, IDataParameter, Int32, Int32, String)
Returns a populated DataTable from the query provided.
Protected methodRunQuery(DbConnection, String, String, IDataParameter, String, String, String)
Runs a query, returning a DataView that contains the results of the query in a named table within a DataSet.
Protected methodRunScalarQuery
Runs a scalar query.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTruncateString
Public methodTypeToDbType
Returns a DbType to go along with a parameter.
Top
See Also
Inheritance Hierarchy