NamedRange.CopyFromRecordset Method
Copies the contents of an ADO or DAO recordset into a worksheet, beginning at the upper-left corner of the NamedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
Function CopyFromRecordset ( _
Data As Object, _
MaxRows As Object, _
MaxColumns As Object _
) As Integer
int CopyFromRecordset(
Object Data,
Object MaxRows,
Object MaxColumns
)
Parameters
- Data
Type: System.Object
The recordset to copy into the range.
- MaxRows
Type: System.Object
The maximum number of records to copy into the worksheet. If this argument is omitted, all the records in the recordset object are copied.
- MaxColumns
Type: System.Object
The maximum number of fields to copy into the worksheet. If this argument is omitted, all the fields in the recordset object are copied.
Return Value
Type: System.Int32
Remarks
If the recordset contains fields with OLE objects in them, this method fails.
Copying begins at the current row of the recordset. After copying is completed, the EOF property of the recordset object is true.
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.