Source 属性(ADO 记录集)

指示 Recordset 对象的数据源。

设置和返回值

设置字符串值或 Command 对象引用;仅返回指示 Recordset 的源的字符串值。

备注

使用 Source 属性通过以下方式之一指定 Recordset 对象的数据源:Command 对象变量、SQL 语句、存储过程或表名。

如果将 Source 属性设置为 Command 对象,则 Recordset 对象的 ActiveConnection 属性将继承指定 Command 对象的 ActiveConnection 属性的值。 但是,读取 Source 属性不会返回 Command 对象;相反,会返回设置 Source 属性的 Command 对象的 CommandText 属性。

如果 Source 属性是 SQL 语句、存储过程或表名,则可以通过使用 Open 方法调用传递相应的 Options 参数来优化性能。

Source 属性对于已关闭的 Recordset 对象是可读/写的,对于打开的 Recordset 对象是只读的。

应用于

记录集对象 (ADO)

另请参阅

Source 属性示例 (VB)
Source 属性(ADO 错误)
Source 属性(ADO 记录)