CodeCharge Studio

DataSource Run-Time Property (ASP)

Applies to

Grid Form, ListBox Control, RadioButton Control, CheckboxList Control, Navigator Control, Record Form, EditableGrid Form, Directory Form, Path Form

Type

Data Source Object

Access

read/write

Syntax

object.DataSource [= value]

Description

This property stores reference to data source bound to the specified object. Data source handles all data retrieval and update operations. It serves as an abstraction layer that hides underlying data source details, whether it is a database, a list of values or even a web service. It is common to use this property to access field values from within bound objects. DataSource object provides properties (i.e. SQL, Where, Order) that can be used to modify the SQL query that is executed in order to provide data for the object.

Examples

This example shows how the SQL property of the DataSource object can be modified to alter the list of values extracted from the database.
Note: the syntax used to concatenate two fields (firstname and lastname) into the name field is not recognized by the standard of SQL language (here it is used for Access database only).
Function customers_DataSource_BeforeBuildSelect() 

 customers.DataSource.Sql = "SELECT customer_id, (firstname & ' ' & lastname) AS name, city FROM customers"

End Function

See also

Connection Property
DataSource.SQL
DataSource.Where
DataSource.Order

Related Examples

Dynamically Modify the SQL Statement
Dynamically Modify the WHERE Clause
Dynamically Modify the WHERE and ORDER BY Clauses of a ListBox
Dynamically Modify the ORDER BY Clause


On-line, printable versions and updates