版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Module 9:Accessing Relational Data Using Microsoft Visual Studio .NET,Overview,Overview of ADO.NET Creating a Connection to a Database Displaying a DataSet in a List-Bound Control,Lesson: Overview of ADO.NET,What is ADO.NET? Using Namespaces The ADO.NET Object Model What is a DataSet? Accessing Data
2、 with ADO.NET Practice: Identifying ADO.NET Components,ADO.NET provides a set of classes for working with data. ADO.NET provides:,An evolutionary, more flexible successor to ADO A system designed for disconnected environments A programming model with advanced XML support A set of classes, interfaces
3、, structures, and enumerations that manage data access from within the .NET Framework,What is ADO.NET?,Using Namespaces,Use the Imports or using statement to import namespaces Namespaces used with ADO.NET include: System.Data System.Data.SqlClient System.Data.OleDb,Imports System.Data Imports System
4、.Data.SqlClient,using System.Data; using System.Data.SqlClient;,DataSet,SQL Server .NET Data Provider,OLE DB .NET Data Provider,SQL Server 7.0 (and later),OLEDB sources(SQL Server 6.5),OleDbConnection,OleDbDataAdapter,SqlDataAdapter,SqlConnection,DataTable,DataTable,The ADO.NET Object Model,SQL Serv
5、er 2000,DataSet,DataTable,DataTable,Physical storage,OleDb Database,SqlDataAdapter,SqlConnection,DataTable,Web server memory,OleDbDataAdapter,OleDbConnection,What is a Dataset?,Accessing Data with ADO.NET,Database,Return the DataSet to the Client,Client manipulates the data,Create the SqlConnection
6、and SqlDataAdapter objects,Fill the DataSet from the DataAdapter and close the connection,SqlDataAdapter,SqlConnection,List-Bound Control,Client makes request,1,2,3,4,5,Update the DataSet,Use the SqlDataAdapter to open the SqlConnection, update the database, and close the connection,6,7,Client,Web s
7、erver,Practice: Identifying ADO.NET Components,Students will: Move icons of various components of ADO.NET to the correct locations Time: 5 Minutes,Lesson: Creating a Connection to a Database,Using Server Explorer to Generate a Connection The DataAdapter Object Model Demonstration: Connecting to a Da
8、tabase Generating a DataSet Demonstration: Generating a DataSet,Using Server Explorer to Generate a Connection,Create a new data connection by dragging a Table from Server Explorer,Create a new data connection using the Data Links dialog box,The DataAdapter Object Model,sp_SELECT,Command,SelectComma
9、nd,UpdateCommand,InsertCommand,DeleteCommand,DataAdapter,Command,Command,Command,Connection,sp_UPDATE,sp_INSERT,sp_DELETE,Database,DataSet,DataReader,Demonstration: Connecting to a Database,Expand Server Explorer to a table in a SQL Server database Drag the table to an ASP.NET Web Form View the data
10、 using the SqlDataAdapter View the source of the page that was created Configure the DataAdapter object,Generating a DataSet,You can generate a DataSet through the UI Creates a DataSet that allows you to access data as an object or through code and then fill,Dim ds As New DataSet(),DataAdapter1.Fill
11、(ds) DataAdapter2.Fill(ds),DataSet ds = new DataSet();,DataAdapter1.Fill(ds); DataAdapter2.Fill(ds);,Demonstration: Generating a DataSet,Create a typed DataSet from a DataAdapter Add a second DataTable from a different DataAdapter Show the schema of DataSet,Lesson: Displaying a DataSet in a List-Bou
12、nd Control,What are List-Bound Controls? Displaying DataSet Data in List-Bound Controls Demonstration: Binding List-Bound Controls to a Database Practice: Using a DataGrid Demonstration: Customizing the DataGrid Control,What are List-Bound Controls?,Controls that connect to a data source and display
13、 the data List-bound controls include the following: DropDownList ListBox CheckBoxList RadioButtonList,DataGrid DataList Repeater,Displaying DataSet Data in List-Bound Controls,Set the properties Fill the DataSet, then call the DataBind method,DataAdapter1.Fill(ds) lstEmployees.DataBind(),DataAdapte
14、r1.Fill(ds); lstEmployees.DataBind();,Demonstration: Binding List-Bound Controls to a Database,Add a DataGrid to a Web Form Set the DataSource and DataMember properties Fill the DataSet Call DataBind(),Practice: Using a DataGrid,Students will: Create a SqlConnection Create a SqlDataAdapter Generate
15、a DataSet Place a DataGrid on a Web Form Bind the DataGrid to the DataSet Time: 5 minutes,Demonstration: Customizing the DataGrid Control,Using AutoFormat Setting custom column headers Paging Sorting,Review,Overview of ADO.NET Creating a Connection to a Database Displaying a DataSet in a List-Bound Control,MedicalMedical.aspx,BenefitsHome PageDefault.aspx,Life InsuranceLife.aspx,RetirementRetirement.aspx,DentalDental.aspx,Dentists,DoctorsDoctors.aspx,Doctors,Logon Page Login.aspx,Registration Register.aspx,CohoWinery,ProspectusProspectus.as
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 内蒙古自治区通辽市2024-2025学年九年级上学期期中考试英语试题(无答案听力原文及音频)
- 2014-2020年全球摄影行业市场分析报告(权威版)
- 2024至2030年中国塑壳电吹风数据监测研究报告
- 2024至2030年中国仲痛舒喷务剂行业投资前景及策略咨询研究报告
- 2024至2030年中国BMX车架数据监测研究报告
- 2024年中国银基钎焊市场调查研究报告
- 2024年中国素色割绒毛巾布市场调查研究报告
- 2024年中国液压顶拔器市场调查研究报告
- 2024年中国微机滴控箱式多用炉机组市场调查研究报告
- 2024年中国中央空调风机调速开关市场调查研究报告
- 胎儿心脏产前筛查指南及胎儿超声心动图规范化操作
- 放疗科护理病区利用PDCA循环降低放疗患者放射性皮肤损伤的发生率品管圈QCC成果汇报
- 《学前儿童数学教育》简答题
- 心理学在人民调解实务中的运用
- 什么状态下启动应急预案
- smt外发加工厂评估报告
- GB/Z 43281-2023即时检验(POCT)设备监督员和操作员指南
- (完整)痔疮手术知情同意书
- 古典诗词之词律课件
- 物流企业运营管理第五章 物流企业业务模式
- 手术麻醉科腰椎穿刺术考核试题
评论
0/150
提交评论