Deprecated
Data Access Layer (DAL) is deprecated. While the existing code keeps working, we recommend switching to Database API.
Each table in DAL is presented as a C#/VB.NET class, all fields are C#/VB.NET variables declared in this class.
Variables/Arrays
Variable/Array |
Description |
Table("TableName") |
Provides access to the TableName.
Example:
dynamic tblCars = GlobalVars.dal.Table("Carsmake");
|
Value["FieldName"] |
Provides access to the field values to be updated or added.
Example:
dynamic tblCars = GlobalVars.dal.Table("Carsmake");
|
Param["FieldName"] |
Provides access to the field values. This function is used in the WHERE clause of the update query. This allows you to avoid the confusion when the same field appears in the field list and in WHERE clause.
Example:
dynamic tblCars2 = GlobalVars.dal.Table("Carsmake");
The corresponding SQL query:
Update Carsmake set 'Make2'='v2' where 'Make'='Volvo'
|
Methods
Method |
Description |
Inserts a new record into the database. |
|
Runs a custom SQL query. |
|
Deletes one or more records from the database. |
|
Executes an SQL query passed as a parameter and returns the first value of the first entry or null if nothing is found. |
|
Selects one or more records matching the condition. |
|
Selects records from database and sorts the data by orderby field/fields and returns the recordset. |
|
Selects all records. |
|
Returns the table name. This function is used for complex queries with calculated fields or joined tables. |
|
Updates one or more records in the database. |
|
Returns a properly formatted login table name. |
|
Adds a new AND condition to the existing WHERE clause. |
Examples
•Before deleting a record check if related records exist
•Redirect to user info edit page
•Show data from master table on details view/edit/add page
•Update multiple records on the List page
See also:
•Using DAL functions in projects with multiple database connections