Download presentation
Presentation is loading. Please wait.
Published byEstella Carpenter Modified over 9 years ago
1
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#
2
WHAT IS ADO.NET ADO.NET is the technology that.NET applications use to interact with database. Data binding is a powerful and practical feature Not easy, must have solid grasp of ADO.NET fundamentals
3
UNDERSTANDING DATA MANAGEMENT
4
THE ROLE OF THE DATABASE Adding database to VS2013
14
ADO.NET BASICS
15
TWO GROUPS OF CLASSES Contain and manage data DataSet, DataTable, DataRow, and DataRelation Generic Connect to specific data source Connection, Command, and DataReader Data providers
17
DATA NAMESPACES
19
DATA PROVIDER CLASSES Data classes can’t accomplish much Data access is needed see table below
20
DIRECT DATA ACCESS The easiest to connect to the database Steps 1. Create Connection, Command, and DataReader objects. 2. Use the DataReader to retrieve information from the database, and display it in a control on a web form. 3. Close your connection. 4. Send the page to the user. At this point, the information your user sees and the information in the database no longer have any connection, and all the ADO.NET objects have been destroyed. To add or update information, follow these steps: 1. Create new Connection and Command objects. 2. Execute the Command (with the appropriate SQL statement).
22
NAMESPACES NEEDED using System.Data; using System.Data.SqlClient;
23
CREATING A CONNECTION SQL Server through the OLE DB provider Using SqlConnection object from the SQL Server
24
THE CONNECTION STRING Data source – name of the server Initial catalog – name of the database Integrated security – using Windows user account, SSPI (security support provider interface) or SQL server user id and password Connection Timeout – how long your code will wait before generating an error
25
STORING THE CONNECTION STRING Using a constructor Store in web.config
26
Import it
27
GRIDVIEW EXAMPLE WITH MDF FILE
38
Drag GridView
41
Bind a data source
44
Download the file from douap.uap.asia
47
The name to be added in the web.config
48
Shows the columns of the database table
49
Test the connection
50
Adding/modifying the properties
64
Adding theme and AutoGenerateEditButton="true"
65
EXERCISE Add insert to the GridView Add UpdateCommand Add DeleteCommand
66
PROBLEM SET Modify the order menu to use mdf files and add CRUD
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.