Spread for ASP.NET 7.0 Product Documentation
DefaultSheetDataModel Constructor(DataSet)
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class > DefaultSheetDataModel Constructor : DefaultSheetDataModel Constructor(DataSet)


dataSource
Data source to be used for this model

Glossary Item Box

Creates a default data model with the specified data set.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal dataSource As DataSet _
)
Visual Basic (Usage)Copy Code
Dim dataSource As DataSet
 
Dim instance As New DefaultSheetDataModel(dataSource)
C# 
public DefaultSheetDataModel( 
   DataSet dataSource
)

Parameters

dataSource
Data source to be used for this model

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.
Visual BasicCopy Code
Dim conStr As String="Provider=Microsoft.JET.OLEDB.4.0;datasource=d:\\nwind.mdb"
Dim sqlStr As String="SELECT*FROM Employees"
Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(conStr)
Dim ds As DataSet= New DataSet()
Dim da As System.Data.OleDb.OleDbDataAdapter= New System.Data.OleDb.OleDbDataAdapter(sqlStr,conn)
da.Fill(ds,"Employees")
Dim dm As New FarPoint.Web.Spread.Model.DefaultSheetDataModel(ds)
FpSpread1.ActiveSheetView.DataModel=dm
FpSpread1.ActiveSheetView.OperationMode=FarPoint.Web.Spread.OperationMode.RowMode
dm.ActiveRow=2
conn.Close()
C#Copy Code
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.OleDbDataAdapter da= new System.Data.OleDb.OleDbDataAdapter(sqlStr,conn);
da.Fill(ds,"Employees");
FarPoint.Web.Spread.Model.DefaultSheetDataModel dm = new FarPoint.Web.Spread.Model.DefaultSheetDataModel(ds);
FpSpread1.ActiveSheetView.DataModel=dm;
FpSpread1.ActiveSheetView.OperationMode=FarPoint.Web.Spread.OperationMode.RowMode;
dm.ActiveRow=2;
conn.Close();

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.