Presentation is loading. Please wait.

Presentation is loading. Please wait.

ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.

Similar presentations


Presentation on theme: "ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#."— Presentation transcript:

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

5

6

7

8

9

10

11

12

13

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

16

17 DATA NAMESPACES

18

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).

21

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

28

29

30

31

32

33

34

35

36

37

38 Drag GridView

39

40

41 Bind a data source

42

43

44 Download the file from douap.uap.asia

45

46

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

51

52

53

54

55

56

57

58

59

60

61

62

63

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


Download ppt "ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#."

Similar presentations


Ads by Google