Ado net fundamentals
Download
1 / 66

Ado fundamentals - PowerPoint PPT Presentation


  • 181 Views
  • Uploaded on

Ado.net fundamentals. Beginning asp.net 3.5 in c# . 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. Understanding data management.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Ado fundamentals' - crete


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Ado net fundamentals

Ado.net fundamentals

Beginning asp.net 3.5 in c#


What is ado net
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



The role of the database
The role of the database

  • Adding database to VS2013


Ado net basics
Ado.net bAsics


Two groups of classes
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



Data provider classes
Data provider classes

  • Data classes can’t accomplish much

  • Data access is needed see table below


Direct data access
Direct data access

  • The easiest to connect to the database

  • Steps

    • Create Connection, Command, and DataReader objects.

    • Use the DataReader to retrieve information from the database, and display it in a control on a web form.

    • Close your connection.

    • 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:

    • Create new Connection and Command objects.

    • Execute the Command (with the appropriate SQL statement).


Namespaces needed
Namespaces needed

using System.Data;

using System.Data.SqlClient;


Creating a connection
Creating a connection

  • SQL Server through the OLE DB provider

  • Using SqlConnection object from the SQL Server


The connection string
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


Storing the connection string
Storing the connection string

  • Using a constructor

  • Store in web.config



Gridview example with mdf file
Gridview example with mdf file


Drag GridView









Exercise
Exercise

  • Add insert to the GridView

  • Add UpdateCommand

  • Add DeleteCommand


Problem set
Problem Set

  • Modify the order menu to use mdf files and add CRUD


ad