指示 Recordset 对象中数据的来源(Command 对象、SQL 语句、表的名称或存储过程)。

设置和返回值

设置字符串值或 Command 对象引用。仅返回字符串值。

说明

使用 Source 属性指定 Recordset 对象的数据源,该 Recordset 对象使用下列项之一:Command 对象变量、SQL 语句、存储过程或表的名称。Source 属性对于关闭的 Recordset 是可读/写的,对于打开的 Recordset 是只读的。

如果设置 Source 属性为 Command 对象,Recordset 对象的 ActiveConnection 属性将继承指定 Command 对象的 ActiveConnection 属性的值。但是,读取 Source 属性将不返回 Command 对象,而是将 Command 对象的 CommandText 属性返回到设置 Source 属性的地方。

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