Show code in...     

  

 

Object Model ExcelApplication Worksheets Worksheet Cells Cell Range
Charts Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area
PivotField PivotFields PivotTable PivotTables
Style Characters Font Pictures Picture DocumentProperties PageSetup


ExcelApplication Object Reference

GetDataFromDataReader Methods

GetDataFromDataReader is available in .NET only. To import database values with ADO in ASP, using ExcelApplication, use CopyFromRecordSet or GetDataFromRecordset.

GetDataFromDataReader(Worksheet, IDataReader, ShowFieldNames, FirstRow, FirstCol)
GetDataFromDataReader(Worksheet, IDataReader, ShowFieldNames, FirstRow, FirstCol, MaxRows, MaxColumns)
GetDataFromDataReader(Worksheet, IDataReader, ShowFieldNames, FirstRow, FirstCol, FieldList, FieldListMode)
GetDataFromDataReader(Worksheet, IDataReader, ShowFieldNames, FirstRow, FirstCol, MaxRows, MaxColumns, FieldList, FieldListMode)

GetDataFromDataReader(Worksheet, IDataReader, ShowFieldNames,
                              FirstRow, FirstCol)
Syntax:
[C#]
public SARange ExcelApplicationDotNet.GetDataFromDataReader(SAWorksheet Worksheet, IDataReader DataReader,
		bool ShowFieldNames, int FirstRow, int FirstCol)
Description:
GetDataFromDataReader imports an IDataReader into a specified range of cells, and returns a Range object
  • Worksheet
    The DataReader will be imported to this worksheet.
  • DataReader
    This parameter must be an instance of System.Data.SqlClient.SqlDataReader or System.Data.OleDb.OleDbDataReader, or GetDataFromDataReader will throw an exception.
  • ShowFieldNames
    If set to True, DataReader column headers will be imported to the first row.
  • FirstRow
    First worksheet row for the imported DataReader.
  • FirstCol
    First worksheet column for the imported DataReader.
Returns:
A Range object.
Example:
SARange Range3 = XlwApp.GetDataFromDataReader(WrkSht3, Reader, true, 7, 1);

Top


GetDataFromDataReader(Worksheet, IDataReader, ShowFieldNames,
                              FirstRow, FirstCol, MaxRows, MaxColumns)
Syntax:
[C#]
public SARange ExcelApplicationDotNet.GetDataFromDataReader(SAWorksheet Worksheet, IDataReader DataReader,
		bool ShowFieldNames, int FirstRow, int FirstCol, int MaxRows, int MaxColumns)
Description:
GetDataFromDataReader imports an IDataReader into a specified range of cells, and returns a Range object.
Parameters:
  • Worksheet
    The DataReader will be imported to this worksheet.
  • DataReader
    This parameter must be an instance of System.Data.SqlClient.SqlDataReader or System.Data.OleDb.OleDbDataReader, or GetDataFromDataReader will throw an exception.
  • ShowFieldNames
    If set to True, DataReader column headers will be imported to the first row.
  • FirstRow
    First worksheet row for the imported DataReader.
  • FirstCol
    First worksheet column for the imported DataReader.
  • MaxRows
    Specifies the maximum number of rows to import from the data source. To import the maximum rows available, use the constant ExcelApplication.ALL_ROWS. Note: Excel 95 will delete rows after 16,384.
  • MaxColumns
    Specifies the maximum number of columns to import from the data source. To import the maximum columns available, use the constant ExcelApplication.ALL_COLUMNS.
Returns:
A Range object.
Example:
SARange Range3 = XlwApp.GetDataFromDataReader(WrkSht3, Reader, true, 
		7, 1, 50, 10);

Top


GetDataFromDataReader(Worksheet, IDataReader, ShowFieldNames,
                              FirstRow, FirstCol, FieldList, FieldListMode)
Syntax:
[C#]
public SARange ExcelApplicationDotNet.GetDataFromDataReader(SAWorksheet Worksheet, IDataReader DataReader,
		bool ShowFieldNames, int FirstRow, int FirstCol,
		string FieldList, SAXLFieldListMode FieldListMode)
Description:
GetDataFromDataReader imports an ADO.NET DataReader into a specified range of cells, and returns a Range object.
Parameters:
  • Worksheet
    The DataReader will be imported to this worksheet.
  • DataReader
    This parameter must be an instance of System.Data.SqlClient.SqlDataReader or System.Data.OleDb.OleDbDataReader, or GetDataFromDataReader will throw an exception.
  • ShowFieldNames
    If set to True, DataReader column headers will be imported to the first row.
  • FirstRow
    First worksheet row for the imported DataReader.
  • FirstCol
    First worksheet column for the imported DataReader.
  • FieldList
    DataReader fields to include or exclude in the spreadsheet, depending on the value of FieldListMode. The parameter FieldList is a comma delimited string specifying DataReader fields to include or exclude. They may be referenced by field name or position, or both. The order in which fields are specified in the FieldList parameter is the order in which they will be returned.
  • FieldListMode
    Includes or excludes fields listed in FieldList parameter. To include only fields specified by the parameter FieldList, set FieldListMode to saxlsInclude.
Returns:
A Range object.
Example:
SARange Range3 = XlwApp.GetDataFromDataReader(WrkSht3, Reader, true, 7, 1
		"ID,Category", saxlsExclude);

Top


GetDataFromDataReader(Worksheet, IDataReader, ShowFieldNames,
                              FirstRow, FirstCol, MaxRows, MaxColumns, FieldList, FieldListMode)
Syntax:
[C#]
public SARange ExcelApplicationDotNet.GetDataFromDataReader(SAWorksheet Worksheet, IDataReader DataReader,
		bool ShowFieldNames, int FirstRow, int FirstCol, int MaxRows, int MaxColumns, 
		string FieldList, SAXLFieldListMode FieldListMode)
Description:
GetDataFromDataReader imports an IDataReader into a specified range of cells, and returns a Range object.
Parameters:
  • Worksheet
    The DataReader will be imported to this worksheet.
  • DataReader
    This parameter must be an instance of System.Data.SqlClient.SqlDataReader or System.Data.OleDb.OleDbDataReader, or GetDataFromDataReader will throw an exception.
  • ShowFieldNames
    If set to True, DataReader column headers will be imported to the first row.
  • FirstRow
    First worksheet row for the imported DataReader.
  • FirstCol
    First worksheet column for the imported DataReader.
  • MaxRows
    Specifies the maximum number of rows to import from the data source. To import the maximum rows available, use the constant ExcelApplication.ALL_ROWS. Note: Excel 95 will delete rows after 16,384.
  • MaxColumns
    Specifies the maximum number of columns to import from the data source. To import the maximum columns available, use the constant ExcelApplication.ALL_COLUMNS.
  • FieldList
    DataReader fields to include or exclude in the spreadsheet, depending on the value of FieldListMode. The parameter FieldList is a comma delimited string specifying DataReader fields to include or exclude. They may be referenced by field name or position, or both. The order in which fields are specified in the FieldList parameter is the order in which they will be returned.
  • FieldListMode
    Includes or excludes fields listed in FieldList parameter. To include only fields specified by the parameter FieldList, set FieldListMode to saxlsInclude.
Returns:
A Range object.
Example:
SARange Range3 = XlwApp.GetDataFromDataReader(WrkSht3, Reader, true, 7, 1,
		50, 10, "ID,Category", saxlsExclude);

Top


Copyright © 2005, SoftArtisans, Inc.