版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2023年晋城市人民医院招聘考试试题及答案
- 2023年成都市温江区社会招聘卫健系统事业单位工作人员考试试题及答案
- 低碳出行行业市场需求分析及未来三年行业预测报告
- 网络剧与微电影行业调研及投资前景分析报告
- 2024年山西客运资格证技巧答题软件
- 2024年双鸭山客运从业资格证考试模拟题
- 2024年陕西客运从业资格证操作考试
- 区块链物联网行业发展建议
- 在线职业规划教育行业的消费心理分析
- 航空运输智能化行业经营模式分析
- 护士腰背部损伤及预防措施
- 《视觉传达设计》题集
- 口腔科常见疾病诊疗规范诊疗指南2022版
- 10《爬山虎的脚》第一课时 教学设计-2023-2024学年四年级语文上册统编版
- 新能源汽车运行安全性能检验规程
- 高风险诊疗技术项目总结报告
- 家用电器销售合同模板
- 广东省六校(北江中学、河源中学、清远一中、惠州中学、阳江中学、茂名中学)2024年高一下学期联考数学试题+答案
- 复旦大学-惠民保2023年度知识图谱
- 2024春季形势与政策讲稿第三讲走好新时代科技自立自强之路
- 2024年东莞电工考试题电工操作证考试内容(全国版)
评论
0/150
提交评论