1 Interface IDbConnection ConnectionString defines data base connection Open and close connection Properties of connection object Creates Command-Object.

Slides:



Advertisements
Similar presentations
17. Data Access ADO.Net Architecture New Features of ADO.NET
Advertisements

ADO.Net Modelo para acesso a dados nas aplicação.Net Componentes: DataSet.Net Data providers: Connection Command DataReader DataAdapter.
Database Connections with ASP.Net
Opret connection til database. Connectionstring setting.
ADO.NET: Working in Disconnected Environment Sergey Baidachni MCT, MCSD, MCDBA.
Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
Connecting to Database 21 Feb Database Options Can use many different databases in conjunction with php. – MySql; MS Access; Oracle; etc etc Most.
Direct Data Access, Data Binding. Content Direct Data Access Data Binding Muzaffer DOĞAN - Anadolu University2.
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
Introduction to Database Processing with ADO.NET.
Using ADO Programmatically The Connection Object and the Command Object.
Database Connectivity Session 2. Topics Covered ADO Object Model Database Connection Retrieving Records Creating HTML Documents on-the-fly.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Securing Enterprise Applications Rich Cole. Agenda Sample Enterprise Architecture Sample Enterprise Architecture Example of how University Apps uses Defense.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
In C# program Before you can start using the ODBC class definitions, you will need to include the right module. using System.Data.Odbc; // ODBC definitions.
Data Access with ADO.NET Dr. Herbert Praehofer Institute for System Software Johannes Kepler University Linz Dr. Dietrich Birngruber Ecolog GmbH Wels ©
8/19/20151 Securing a Database Based on notes by Fei Li and Hong Li.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
Chapter 61 Managing Data Sources Introduction to ASP.NET By Kathleen Kalata.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
Accessing SQL Server and OLE DB from.NET Svetlin Nakov Telerik Corporation
PART 1 CREATING THE PRODUCT CATALOG. ROADMAP FOR THIS CHAPTER To implement the departments list, you’ll start with the database and make your way to the.
Databases and Data Access  Introduction to ADO.NET  ADO.NET objects  ADP.NET namespaces  Differences between ADO and ADO.NET.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
 It is the primary data access model for.Net applications  Next version of ADO  Can be divided into two parts ◦ Providers ◦ DataSets  Resides in System.Data.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL ADO.Net Basics Ruwan Wijesinghe Trainer.
10/26/20151 Chapter 3 Introduction to ADO.NET In this chapter, you will: Learn the basic classes in ADO.NET and its architecture Learn the different ADO.NET.
Module 2: Connecting to Data Sources. Overview Choosing a.NET Data Provider Defining a Connection Managing a Connection Handling Connection Exceptions.
Module 7: Accessing Data by Using ADO.NET
ADO.NET Data Access. Page  2 SQL  When we interact with the datasource through ADO.NET we use the SQL language to retrieve,modify,update information.
1.Net programmingADO.NETNOEA / PQC ADO.NET Architecture Connection factory Config file DataReader DataSet DataGrid Autogeneration of SQL.
Module 3: Performing Connected Database Operations.
ADO.NET connections1 Connecting to SQL Server and Oracle.
 It is the primary data access model for.Net applications  Next version of ADO  Can be divided into two parts ◦ Providers ◦ DataSets  Resides in System.Data.
1 11/10/05CS360 Windows Programming ADO.NET. 2 11/10/05CS360 Windows Programming ADO.NET  Behind every great application is a database manager o Amazon.
Accessing SQL Server and MySQL from.NET and C# Learning & Development Team Telerik Software Academy.
DAT430 Extending Microsoft ® ADO.NET Building a Custom Data Factory API DAT430 Extending Microsoft ® ADO.NET Building a Custom Data Factory API Gert E.R.
PHP Programming. Topics Database Handling (MySQL, MSSQL, ODBC)
HNDIT Rapid Application Development
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
C# .NET Software Development
1 ADO Activex Data Objects. 2 ADO ADO allows users to access data easily from many existing databases (such as Access or Paradox) From ODBC compliant.
DATABASE SYSTEM VB LINK TO MS-SQL. 2 Visual ProgrammingChapter 6 Select Project -> Component.
Объект Command Свойства объекта Command Connection CommandText.
Introduction to Database C# MySQL onnect-C-to-MySQL 1.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
.NET Data Access and Manipulation
 2 Data Object Library approaches ◦ DAO (Data Access Objects)  Original access strategy (up to VB6)  Closely linked to MS Access ◦ ADO (ActiveX Data.
C# MySQL onnect-C-to-MySQL 1.
 ADO.NET is an object-oriented set of libraries that allows you to interact with data sources  Commonly, the data source is a database, but it could.
Data Access with ADO.NET
Introduction to Database Processing with ADO.NET
Managing, Storing, and Executing DTS Packages
Coding ADO.NET Objects: Connection, Command, DataReader
Introduction to Database Processing with ADO.NET
ADO.NET Framework.
PROG Advanced Web Apps 5/23/2018 Notes on ADO.NET (1) Wendi Jollymore, ACES.
Programming the Web Using ASP.Net
How to Create Login Form using vb.net and SqlServer Database
Lecture 6 VB.Net SQL Server.
Active Data Objects Binding ASP.NET Controls to Data
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Chapter 10 ADO.
Active Data Objects Binding ASP.NET Controls to Data
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Presentation transcript:

1 Interface IDbConnection ConnectionString defines data base connection Open and close connection Properties of connection object Creates Command-Object Creates Transaction-Object string ConnectionString {get; set;} string Database {get;} int ConnectionTimeout {get;} ConnectionState State {get;} IDbCommand CreateCommand(); IDbTransaction BeginTransaction(); IDbTransaction BeginTransaction(IsolationLevel lvl); void Open(); void Close();

2 IDbConnection: Property ConnectionString Key-value-pairs separated by semicolon (;) Configuration of the connection –name of the provider –identification of data source –authentication of user –other database-specific settings e.g.: OLEDB: "provider=SQLOLEDB; data source= \\NetSDK; initial catalog=Northwind; user id=sa; password=; " "provider=Microsoft.Jet.OLEDB.4.0;data source=c:\bin\LocalAccess40.mdb;" "provider=MSDAORA; data source=ORACLE8i7; user id=OLEDB; password=OLEDB ;“ e.g.: MS-SQL-Server: "data source=(local)\\NetSDK; initial catalog=Northwind; user id=sa; pooling=false; Integrated Security=SSPI; connection timout=20;" SqlServer Access Oracle

3 DbProviderFactory Writing database-independent programs with DbProviderFactory DbProviderFactory generates set of provider-specific components Provider can be configured in an easy way (e.g. in configuration file) DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.SqlClient"); IDbConnection conn = factory.CreateConnection(); IDbCommand cmd = factory.CreateCommand(); cmd.Connection = conn; IDataParameter param = factory.CreateParameter(); create DbProviderFactory for SqlClient create provider specific data access components DBConnection DbCommand DataParameter

4 ConnectionStringBuilder Creation of connection string can be error-prone ConnectionStringBuilder provides support: –Definition with key-value pairs –Validation of syntactical correctness and completeness DbConnectionStringBuilder builder = factory.CreateConnectionStringBuilder(); builder["Server"] = "localhost\\SQLEXPRESS"; builder["Initial Catalog"] = "Northwind"; builder["Integrated Security"] = true; conn.ConnectionString = builder.ConnectionString; conn.Open(); create ConnectionStringBuilder and set values retrieve connection string and configure connection

5 Command Objects Command objects define SQL statements or stored procedures Executed for a connection May have parameters May belong to a transaction IDbCommand IDbConnection 1 IDbTransaction 0..1 * IDataParameter * 1

6 Interface IDbCommand CommandText defines SQL statement or stored procedure Connection object Type and timeout properties Creating and accessing parameters Execution of command string CommandText {get; set;} CommandType CommandType {get; set;} int CommandTimeout {get; set;} IDbDataParameter CreateParameter(); IDataParameterCollection Parameters {get;} IDataReader ExecuteReader(); IDataReader ExecuteReader(CommandBehavior b); int ExecuteNonQuery(); object ExecuteScalar(); IDbConnection Connection {get; set;}