版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年即时零售 餐饮堂食外带项目可行性研究报告
- 2026贵州铝业集团双元新材料有限责任公司招聘6人备考题库及答案详解(新)
- 2026年企业IT设备弹性租赁服务项目公司成立分析报告
- 2026年宠物医疗保健项目公司成立分析报告
- 2026年工业互联网标识解析项目可行性研究报告
- 2026贵州黔南州长顺县“雁归兴顺”人才回流13人备考题库含答案详解(黄金题型)
- 2026福建泉州经济技术开发区第二实验幼儿园合同教师招聘1人备考题库及答案详解(真题汇编)
- 2026黑龙江七台河市农投百安供热有限公司招聘16人备考题库附答案详解(考试直接用)
- 2026贵州省人民医院招聘事业编制10人备考题库附参考答案详解(突破训练)
- 2026辽宁省妇幼保健院招聘高层次和急需紧缺人才10人备考题库附答案详解(综合卷)
- (2025版)中国焦虑障碍防治指南
- 46566-2025温室气体管理体系管理手册及全套程序文件
- GB/T 26951-2025焊缝无损检测磁粉检测
- 2024绍兴文理学院元培学院教师招聘考试真题及答案
- 下腔静脉滤器置入术课件
- 船舶年度检修报告范文
- DB4403T399-2023居家适老化改造与管理规范
- 光学干涉测量技术
- 天龙功放avr4311说明书
- 大学物理课件:第一章 演示文稿
- 《讲直译与意译》PPT课件.ppt
评论
0/150
提交评论