Spread ASP.NET 16
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread.Model Namespace / DefaultSheetDataModel Class / DefaultSheetDataModel Constructor / DefaultSheetDataModel Constructor(DataSet,String)
Data source to be used for this model
Data table name
Example


In This Topic
    DefaultSheetDataModel Constructor(DataSet,String)
    In This Topic
    Creates a default data model with the specified data set.
    Syntax
    'Declaration
     
    Public Function New( _
       ByVal dataSource As DataSet, _
       ByVal dataMember As String _
    )
    'Usage
     
    Dim dataSource As DataSet
    Dim dataMember As String
     
    Dim instance As New DefaultSheetDataModel(dataSource, dataMember)
    public DefaultSheetDataModel( 
       DataSet dataSource,
       string dataMember
    )

    Parameters

    dataSource
    Data source to be used for this model
    dataMember
    Data table name
    Remarks
    For more information about the DataSet class, see the Microsoft .NET Framework Reference.
    Example
    This example creates a new default data model, binds it to a database in its constructor and attaches it to the DataModel of the active sheet.
    Dim conStr As String="Provider=Microsoft.JET.OLEDB.4.0;datasource=d:\\nwind.mdb"
    Dim sqlStr As String="SELECT*FROMEmployees"
    Dim conn As System.Data.OleDb.OleDbConnection=NewSystem.Data.OleDb.OleDbConnection(conStr)
    Dim ds As DataSet = New DataSet()
    Dim da As System.Data.OleDb.OleDbDataAdapter=NewSystem.Data.OleDb.OleDbDataAdapter(sqlStr,conn)
    da.Fill(ds,"Employees")
    Dim dm As NewFarPoint.Web.Spread.Model.DefaultSheetDataModel(ds,"Employees")
    FpSpread1.ActiveSheetView.DataModel=dm
    FpSpread1.ActiveSheetView.OperationMode=FarPoint.Web.Spread.OperationMode.RowMode
    dm.ActiveRow=2
    conn.Close()
    string conStr="Provider=Microsoft.JET.OLEDB.4.0;datasource=d:\\nwind.mdb";
    string sqlStr="SELECT*FROMEmployees";
    System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(conStr);
    DataSet ds = new DataSet();
    System.Data.OleDb.OleDbDataAdapterda=NewSystem.Data.OleDb.OleDbDataAdapter(sqlStr,conn);
    da.Fill(ds,"Employees");
    FarPoint.Web.Spread.Model.DefaultSheetDataModel dm = new FarPoint.Web.Spread.Model.DefaultSheetDataModel(ds,"Employees");
    FpSpread1.ActiveSheetView.DataModel=dm;
    FpSpread1.ActiveSheetView.OperationMode=FarPoint.Web.Spread.OperationMode.RowMode;
    dm.ActiveRow=2;
    conn.Close();
    See Also