Spread for ASP.NET 7.0 Product Documentation
DataSource Property
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > FpSpread Class : DataSource Property


Glossary Item Box

Gets or sets the name of the data source that populates the active sheet for the Spread component.

Syntax

Visual Basic (Declaration) 
Public Property DataSource As Object
Visual Basic (Usage)Copy Code
Dim instance As FpSpread
Dim value As Object
 
instance.DataSource = value
 
value = instance.DataSource
C# 
public object DataSource {get; set;}

Property Value

Object containing the name of the data source

Example

This example binds the spreadsheet to an Access database using the DataSource property.
C#Copy Code
string conStr  = "Provider=Microsoft.JET.OLEDB.4.0;data source=d:\\nwind.mdb";
string sqlStr = "SELECT * FROM Employees";
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");
FpSpread1.DataSource = ds;
FpSpread1.DataBind();
conn.Close();
Visual BasicCopy Code
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=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")
FpSpread1.DataSource = ds
FpSpread1.DataBind()
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.