Download presentation
Presentation is loading. Please wait.
Published byLindsay Atkinson Modified over 8 years ago
2
Using Data in Microsoft Visual Studio 2005 Tools for the Microsoft Office System Mike Hernandez Product Manager Visual Studio Tools for Office
3
Agenda Connecting to a Data Source The Data Sources Window Data Access Objects Displaying Data in Excel Simple Data Binding Complex Data Binding Displaying Data in Word Simple Data Binding Complex Data Binding
4
Data Sources Window Provides a means for you to define data sources for your solution You define new data sources using the Data Source Configuration Wizard Provides easy access to your data sources You can drag and drop a data source on to the document surface or on to an existing control Doing so will produce a Strongly-typed DataSet TableAdapter BindingSource
5
DataSet Data Access Objects Database DataTable DataView BindingSource NamedRangeListObjectLabelBookmarkNamedRangeTextBoxLabel TableAdapter
6
Using a Typed DataSet Easy access to tables and fields in DataSet Code against user-defined data structures without having to know the physical representation of the data Write code against the data without having to know the Word or Excel object model NorthwindDataSet.Employees(0).FirstName = “Joe”
7
TableAdapter Communication layer between the DataSet and the database A TableAdapter is generated for each data table It can do things such as fill a dataset run queries execute stored procedures save changes to the data source EmployeesTableAdapter.Fill (Me.NorthwindDataSet.Employees) EmployeesTableAdapter.Fill (Me.NorthwindDataSet.Employees)
8
BindingSource Provides navigation methods: MoveFirst, MoveNext, MovePrevious, MoveLast Provides data manipulation capabilities such as Find, Filter, Sort, AddNew and Remove NamedRange ListObject Label Database Binding Source
9
Agenda Connecting to a Data Source The Data Sources Window Data Access Objects Displaying Data in Excel Simple Data Binding Complex Data Binding Displaying Data in Word Simple Data Binding Complex Data Binding
10
Simple Data Binding Binding a property of one control to a property of another control or a field in a data table At design time set the DataBindings property At run time call DataBindings.Add Or, simply drag and drop from Data Sources window
11
Simple Data Binding in Excel
12
Complex Data Binding Binding more than one field or record of a data source to a control Drag and drop a data source on to the document to create a data bound ListObject This enables you to display a master/detail view of related DataTables
13
Complex Data Binding in Excel
14
Updating Data to the Data Source Changes saved to the DataSet are not automatically propagated to the data source Use the TableAdapter.Update method to save changes to the data source Me.EmployeesTableAdapter.Update (Me.NorthwindDataSet.Employees) Me.EmployeesTableAdapter.Update (Me.NorthwindDataSet.Employees)
15
Agenda Connecting to a Data Source The Data Sources Window Data Access Objects Displaying Data in Excel Simple Data Binding Complex Data Binding Displaying Data in Word Simple Data Binding Complex Data Binding
16
Simple Data Binding Bookmark controls XMLNode controls At design time set the DataBindings property At run time call DataBindings.Add FirstNameBookmark.DataBindings.Add (“Value2”, Me.EmployeesBindingSource, “FirstName”, formattingEnabled, updateMode)
17
Displaying Complex Data You can display data in a table programmatically Bind data to XML nodes Call Load or LoadXML to import data into XMLNode controls Attach schema, map XML, load XML Use managed controls, such as a grid control rootXMLNode.Load(“filename.xml”) rootXMLNode.LoadXML(XMLstring) rootXMLNode.Load(“filename.xml”) rootXMLNode.LoadXML(XMLstring)
18
Displaying Data in Word
19
Summary Data Sources window provides access to data sources Data Source Configuration Wizard enables you to create data sources for your solution Dragging and dropping a data source on to a document creates the typed DataSet, TableAdapter, and BindingSource objects You can do simple data binding to host controls and managed controls You can do complex data binding to list objects
20
For More Information MSDN Developer Centers VSTO section of the Microsoft Office Developer Center http://msdn.microsoft.com/office/understanding/vsto/ http://msdn.microsoft.com/office/understanding/vsto/ VSTO section of the Smart Client Developer Center http://msdn.microsoft.com/smartclient/understanding/vsto/ http://msdn.microsoft.com/smartclient/understanding/vsto/ VSTO Forum http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=16 http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=16 VSTO-related blogs http://blogs.msdn.com/vsto2/ http://blogs.msdn.com/andreww/ http://blogs.msdn.com/eric_carter/ http://blogs.msdn.com/http://blogs.msdn.com/tq CTP Download http://www.microsoft.com/downloads http://www.microsoft.com/downloads VSTO Forum Resources http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=196504&SiteID=1 http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=196504&SiteID=1
21
Resources Technical Chats and Webcasts http://www.microsoft.com/communities/chats/default.mspx http://www.microsoft.com/usa/webcasts/default.asp Microsoft Learning and Certification http://www.microsoft.com/learning/default.mspx MSDN & TechNet http://microsoft.com/msdn http://microsoft.com/technet Virtual Labs http://www.microsoft.com/technet/traincert/virtuallab/rms.mspx Newsgroups http://communities2.microsoft.com/ communities/newsgroups/en-us/default.aspx Technical Community Sites http://www.microsoft.com/communities/default.mspx User Groups http://www.microsoft.com/communities/usergroups/default.mspx
22
© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.