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.

Slides:



Advertisements
Similar presentations
Database Connections with ASP.Net
Advertisements

Basic SQL Introduction Presented by: Madhuri Bhogadi.
Query Manager. QM is a collection of tools you can use to obtain information from the AS/400 database Used to –select, arrange, and analyze information.
Introduction to Database Processing with ADO.NET.
Introduction to Structured Query Language (SQL)
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
1 Creating a Non-Conditional List A- What are you going to do? You will “list” “all of the records” in a database. (it means you will not use any condition!)
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Introduction to Structured Query Language (SQL)
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
CORE 2: Information systems and Databases STORAGE & RETRIEVAL 2 : SEARCHING, SELECTING & SORTING.
Rationale Aspiring Database Developers should be able to efficiently query and maintain databases. This module will help students learn the Structured.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
ASP.NET Programming with C# and SQL Server First Edition
15 Structured Query Language (SQL). 2 Objectives After completing this section, you should be able to: Understand Structured Query Language (SQL) and.
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.
SQL/lesson 2/Slide 1 of 45 Retrieving Result Sets Objectives In this lesson, you will learn to: * Use wildcards * Use the IS NULL and IS NOT NULL keywords.
Introduction to databases and SQL. What is a database?  A database is an organized way of holding together pieces of information  A database refers.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Database, SQL, and ADO.NET- Part 1 Session 11 Mata kuliah: M0874 – Programming II Tahun: 2010.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
Session 8: ADO.NET. Overview Overview of ADO.NET What is ADO.NET? Using Namespaces The ADO.NET Object Model What is a DataSet? Accessing Data with ADO.NET.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Oracle & SQL Introduction. Database Concepts Revision DB? DBMS? DB Application? Application Programs? DBS? Examples of DBS? Examples of DBMS? 2Oracle.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
5. Simple SQL using Oracle1 Simple SQL using Oracle 5. Working with Tables: Data management and Retrieval 6. Working with Tables: Functions and Grouping.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Mauricio Featherman, Ph.D. Washington St. University
Databases and ADO.NET Programming Right from the Start with Visual Basic.NET 1/e 11.
HNDIT Rapid Application Development
SQL.. AN OVERVIEW lecture3 1. Overview of SQL 2  Query: allow questions to be asked of the data and display only the information required. It can include.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
1 Database Programming with ADO.NET Kashef Mughal.
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
Simple Queries DBS301 – Week 1. Objectives Basic SELECT statement Computed columns Aliases Concatenation operator Use of DISTINCT to eliminate duplicates.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
ADVANCED SQL.  The SQL ORDER BY Keyword  The ORDER BY keyword is used to sort the result-set by one or more columns.  The ORDER BY keyword sorts the.
MySQL Tutorial. Databases A database is a container that groups together a series of tables within a single structure Each database can contain 1 or more.
.NET Data Access and Manipulation
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
Data Access with ADO.NET
Introduction to Database Processing with ADO.NET
Databases.
Chapter 5 Introduction to SQL.
Connect to SQL Server and run select statements
Oracle & SQL Introduction
© 2016, Mike Murach & Associates, Inc.
Introduction to Structured Query Language(SQL)
Lecture 6 VB.Net SQL Server.
VB.NET Using Database.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Access: SQL Participation Project
Chapter 10 ADO.
Introduction To Structured Query Language (SQL)
Presentation transcript:

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  Structured Query Language is a standard data access language used to interact with relational database  SQL Select Statement  Update Statement  Insert Statement  Delete Statement

Page  3 SQL Select Statement  To retrieve one or more rows of data the select command is used SELECT [columns] FROM [tables] WHERE [search_condition] ORDER BY [order_expression ASC | DESC]

Page  4 Sample Select Statement (eg) SELECT * FROM Authors  (*) - retrieves all the columns from the table  The FROM clause identifies that the Author table is being used  There is no WHERE clause, means all the records will be retrieved  There is no ORDER BY clause, means the data’s are not sorted

Page  5 Improving the Select Statement SELECT lname,fname FROM Authors WHERE State =‘MI’ ORDER BY lname ASC  Only two columns are retrieved  WHERE Clause provides the restriction to a particular state  An ORDER BY clause sorts the lname alphabetically in ascending order

Page  6 The WHERE clause (eg)SELECT * FROM Sales WHERE ord_date ‘1987/01/01’  Multiple conditions can be combined using the AND keyword  Greater than and Less than comparisons can be made using symbols

Page  7 SQL Update Statement  Syntax: Eg UPDATE Authors SET lname=‘Gowri’ WHERE id =‘101’ UPDATE [table] SET [update_epression] WHERE [search_condition]

Page  8 SQL Insert Statement  Syntax Eg INSERT INTO Authors (lname,fname) VALUES (‘John’,’Khan’) INSERT INTO [table] ([column_list]) VALUES ([value_list])

Page  9 The SQL Delete Statement  Syntax  Eg DELETE FROM Authors WHERE id=‘102 DELETE FROM [table] WHERE [search_condition]

Page  10 Simple Data Access  To retrieve information with simple Data Access follow these steps  Create Connection,Command,DataReader objects  Use DataReader to retrieve information from the database and display it in a control in the webform  Close your connection  Send the page to the user.At this point all the connections have been closed

Page  11 Importing Namespaces  Imports System.Data  Imports System.Data.OleDb (OR)  Imports System.Data.SqlClient

Page  12 Creating a connection  The first step is to make a connection with the database  Specify a value for the ConnectionString property  This property defines all the information the computer needs to find the data source,log in and initial database

Page  13 The Connection String  The ConnectionString is actually a series of distinct pieces of information,separated by semicolons(;)  Provider –This refers to the name of the Provider which allows communication between ADO.NET and database (SQLOLEDB is the provider for SQL)  Data Source – This refers to the name of the server where the data source is located;Server is on the same computer so localhost

Page  14 The Connection String  Initial CataLog – It refers to the name of the initial database  User ID – Used to access the database,sa refers to the system admin account  Password - By default the ‘sa’ account does not have a password  ConnectionTimeout – It determines how long your code will wait in seconds before generating an error if it cannot establish connection default 15 seconds

Page  15 SQl Server Integrated Authentication  With SQL Server Authentication SQL Server maintains its own user account With integrated authentication SQL Server automatically uses the windows account information for the currently logged in user

Page  16 Making the connnection

Page  17 Defining a select command  The connection object a few basic properties that give the information about the connection  An SQL Statement that selects the information you want (eg) SELECT * from Authors  A command object that executes the SQL statement SqlDataAdapter adap=new SqlDataAdapter(“SELECT * from Author”,con)  A DataSet object to store the retrieved objects (eg)DataSet ds=new DataSet()