Databases – Unit 3 & 4.  SQL is not restricted to a specific database, however in class we will be looking at the two major database programmes in use.

Slides:



Advertisements
Similar presentations
By Chris Pascucci and FLF
Advertisements

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.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Using ADO.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
1 ADO.NET. 2.NET Framework Data Namespaces System.Data –Base set of classes and interfaces for ADO.NET System.Data.Common –Classes shared by the.NET Data.
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:
C# Programming: From Problem Analysis to Program Design1 Working with Databases C# Programming: From Problem Analysis to Program Design 3 rd Edition 14.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Objective In this session we will discuss about : What is ADO. NET ?
Lecture 11: Programmatic Database Access with ADO.NET.
C# programming with database Basic guideline. First step Install SQL Server 2008/2010 (Professional edition if possible) Install Visual Studio 2008/2010.
9-1 Chapter 9 Working with Databases in VB.NET. 9-2 Learning Objectives Understand how databases are used to store business data and how they differ from.
ADO.NET – part II August 2004 [ Marmagna Desai]. CONTENTS ADO vs ADO.NET ADO.NET – Managed providers Connecting to Database SqlConnection Selecting Database.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
ASP.NET Part 4 Instructor: Charles Moen CSCI/CINF 4230.
1 Introducing Database Access from Web Applications by Sally Kyvernitis.
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.
CIS 451: Using ASP.NET Objects with SQL Dr. Ralph D. Westfall February, 2009.
Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases.
A Simple Introduction. What is ADO.net? First the word ADO stands for ActiveX Data Objects And it is an integral part of.Net Framework of Microsoft hence.
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.
.NET Data Access and Manipulation ADO.NET. Overview What is ADO.NET? Disconnected vs. connected data access models ADO.NET Architecture ADO.NET Core Objects.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with Disconnected Data The DataSet and SqlDataAdapter ADO.NET - Lesson.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL ADO.Net Basics Ruwan Wijesinghe Trainer.
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.
ASP.NET Rina Zviel-Girshin Lecture 5
Module 9: Accessing Relational Data Using Microsoft Visual Studio.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.
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.
How to Connect to Database ODBC (Open Database Connectivity) ADO (ActiveX Data Object) ASP Code To Connect to Database Recordset Object Navigating through.
Christopher M. Pascucci.NET Programming: Databases & ADO.NET.
1 UCN Technology: Computer Science: Autumn 2012 ADO.NET 2.0 Architecture DataReader DataSet Connection factory Config file.
1.Net programmingADO.NETNOEA / PQC ADO.NET Architecture Connection factory Config file DataReader DataSet DataGrid Autogeneration of SQL.
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
An Introduction to ADO.Net Marmagna Desai.NET Seminar, Fall-2003.
 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.
C# Programming in Depth Prof. Dr. Bertrand Meyer March 2007 – May 2007 Chair of Software Engineering Lecture 10: Database Lisa (Ling) Liu.
The Problems HTTP is disconnected So many database vendors Create a simple consistent versatile interface on the data Look at ADO.NET classes OleDb SQL.
Mauricio Featherman, Ph.D. Washington St. University
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
HNDIT Rapid Application Development
2314 – Programming Language Concepts Introduction to ADO.NET.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
Module 4 Introduction ADO.NET.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
Using Database: A very, very short introduction..
Data Access. ADO.NET ADO.NET is the primary library for building database solutions within the.NET Framework. ADO.NET does not replace ADO. ADO and OLEDB.
.NET Data Access and Manipulation
C# 1 CSC 298 ADO.NET. C# 2 ADO.NET  A data access technology that maps very well to the world of the web (disconnected architecture)  data is retrieved.
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
ASP.NET Programming with C# and SQL Server First Edition
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
ADO.NET and Stored Procedures
ADO.NET Framework.
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)
Browser (Client Side) 瀏覽器 (客戶端)
Chapter 10 ADO.
Introduction to Database Programming through ADO. NET
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Databases – Unit 3 & 4

 SQL is not restricted to a specific database, however in class we will be looking at the two major database programmes in use  Access – basic database, usable for academic purposes and basic data purposes  SQL Server – industry recognised database, more adaptable, more ‘in depth’

 Made up of US English based ‘key words’  US? US spelling of words is used throughout programming languages due to their origins:  Colour is coded as color (feel free to twitch)

 ADO.Net provides a ‘namespace’ for all possible database connections  System.Data.OleDb  System.Data.SqlClient  Each namespace contains all the functions you will need to manipulate the database and data inside it Access database SQL Server database

 ADO has different versions as it has developed  In version 2.1 more objects were released, ADOX is essentially: ADO eXtrensions  In ADOX all objects use Generalisation to define objects (remember the essays?)

 Dataset  Dataset – stores all data held in ‘cache’  DataAdapter  DataAdapter – represents a bridge between the Dataset and Database holding the: ▪ Connection String ▪ SQL Commands  ConnectionDatasource  Connection – the address of your Datasource (aka database)

 Before you can create any functional SQL your application must be able to connect to your database.  All database connections are called a ‘connection string’  These can be set as global variables or ‘per page’ connections may also be set

public void ConnectToAccess() { System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(); conn.ConnectionString source= C:\Documents and Settings\username\" Documents\AccessFile.mdb"; try { conn.Open(); } catch (Exception ex) { MessageBox.Show("Failed to connect to data source"); } finally { conn.Close(); } } Call an instance of ADO.Net namespace Create the ‘string’ address for your database Try Catch Statement

 Why create a table?  Temporary tables may be created, filled and deleted  Why? Memory Management – A large update is quicker than many small updates

try { conn.Open(); string strTemp = " [FirstName] Text, [LastName] Text "; OleDbCommand myCommand = new OleDbCommand(); myCommand.Connection = conn; myCommand.CommandText = "CREATE TABLE tbl_People(" + strTemp + ")"; myCommand.ExecuteNonQuery(); }

try { conn.Open(); string strTemp = " [FirstName] = " + txtFname.text + ", [LastName] = " + txtLname.Text; OleDbCommand myCommand = new OleDbCommand(); myCommand.Connection = conn; myCommand.CommandText = “INSERT INTO tbl_People(" + strTemp + ")"; myCommand.ExecuteNonQuery(); }

 The Datagrid is a massively useful tool for showing multiple records of data  Using a simple statement records can be shown as a read only table or an editable form

private void Form1_Load(object sender, System.EventArgs e) { Try { OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Student","Provider=Microsoft.JET.OLEDB.4.0;data source=C:\\mcb.mdb" ); DataSet ds = new DataSet(); da.Fill(ds, “Fname"); dataGrid1.DataSource = ds.Tables[“FName"].DefaultView ; } catch (Exception ex) { MessageBox.Show("Failed to connect to data source"); } finally { conn.Close(); } }

 Create yourself a set of revision notes for the SQL code used here. This should include:  A Table of Keywords and their uses  An explanation of ADO  An explanation of connection strings  An explanation of a dataset