版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 五年级数学(小数四则混合运算)计算题专项练习及答案
- 储能电站设备远程监控技术实施方案
- 2025-2030中国冻干鲍鱼市场销售模式及竞争策略分析研究报告
- 火灾自动报警系统实施方案
- 多器官衰竭的精准诊疗方案设计
- 2025-2030中国美甲行业盈利模式及未来运营效益可行性研究报告
- 2025-2030新加坡航空客运行业市场现状供需分析及投资评估策略分析研究报告
- 2025-2030新加坡物流服务行业市场开发前景分析现状调研规划书
- 2025-2030新加坡旅游酒店行业市场发展趋势供需研究及企业投资布局规划分析报告
- 2025-2030新加坡工业机器人应用行业市场现状供需分析及投资评估规划分析研究报告
- 2026年内蒙古白音华铝电有限公司招聘备考题库带答案详解
- 2025年玉溪市市直事业单位选调工作人员考试笔试试题(含答案)
- 2026年涉县辅警招聘考试备考题库附答案
- 2026湖南株洲市芦淞区人民政府征兵办公室兵役登记参考考试题库及答案解析
- 2026年高考语文备考之18道病句修改专练含答案
- 私域流量课件
- 2025年杭州余杭水务有限公司招聘36人笔试备考试题及答案解析
- GB/T 7251.5-2025低压成套开关设备和控制设备第5部分:公用电网电力配电成套设备
- 江苏省2025年普通高中学业水平合格性考试英语试卷(含答案)
- 机器人手术术后引流管管理的最佳实践方案
- 梅索尼兰调节阀
评论
0/150
提交评论