1 11/8/05CS360 Windows Programming Databases and Data Representation.

Slides:



Advertisements
Similar presentations
CSE 190: Internet E-Commerce Lecture 10: Data Tier.
Advertisements

Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
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.
FIRST COURSE Microsoft Access (Basics). XP Objectives Define the terms field, record, table, relational database, primary key, and foreign key. Learn.
ADO. NET. What is “ADO.Net”? ADO.Net is a new object model for dealing with databases in.Net. Although some of the concepts are similar to the classical.
BA271 Week 7 Lecture Building the database Dave Sullivan.
Generic Data Access in Microsoft.NET: a Compelling Example of Inheritance, Interfaces, and the Factory Method Design Pattern OOPSLA 2004 : Design Patterns.
Database Design Chapter 3.
How to use MySql With C# Ross Sherman 1. Using MySql MySql is free. You could download it from:
Define Table Relationships—1 of 3 One of the most powerful features of a relational database management system, such as Access, is its ability to define.
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
ASP.NET Part 3 Instructor: Charles Moen CSCI/CINF 4230.
ADO.NET – part II August 2004 [ Marmagna Desai]. CONTENTS ADO vs ADO.NET ADO.NET – Managed providers Connecting to Database SqlConnection Selecting Database.
Connecting a.NET application to a database Jim Warren, COMPSCI 280 S Enterprise Software Development.
SQL HW1 Turn in as a hardcopy at the start of next class period. You may work this assignment in groups.
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
Views, Indexes and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Haiman Tian 1.
Information Systems Today (©2006 Prentice Hall) MySQL 1CS3754 Class Note #8, Is an open-source relational database management system 2.Is fast and.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
1 11/3/05CS360 Windows Programming Databases and Data Representation.
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
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.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
Neal Stublen Populating a Database  SQLExpress should be installed with Visual Studio  The book provides a.sql file for populating.
CS795/895: Introduction. Topics Distributed Systems –Availability –Performance –Web Services Security –Authentication –Authorization –Confidentiality.
ADO.Net CS795. What is ADO.Net? Database language spoken by managed applications ADO.net database accesses go through modules: data providers –SQL Server.Net.
JAVA Database Access. JDBC The Java Database Connectivity (JDBC) API is the industry standard for database- independent connectivity between the Java.
.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.
PLUG IT IN 3 Fundamentals of Relational Database Operations.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
MySQL Connection using ADO.Net Connecting to MySQL from.NET Languages.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL ADO.Net Basics Ruwan Wijesinghe Trainer.
1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database.
Chapter 25 Databases. Chapter Scope Database concepts Tables and queries SQL statements Managing data in a database Java Foundations, 3rd Edition, Lewis/DePasquale/Chase25.
MySQL and JDBC Tutorial ECT 7130 Hong Cheng. Supplement on MySQL ement/Supplement4bMySQL.pdf.
C# Programming in Depth Prof. Dr. Bertrand Meyer March 2007 – May 2007 Chair of Software Engineering Lecture 10: Database Lisa (Ling) Liu.
CS499 Project #3 XML mySQL Test Generation Members Erica Wade Kevin Hardison Sameer Patwa Yi Lu.
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.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
Distributed Database Systems INF413. ADO.NET is a set of classes that comes with the Microsoft.NET framework to facilitate data access from managed languages.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
ADO.Net CS795. What is ADO.Net? Database language spoken by managed applications ADO.net database accesses go through modules: data providers –SQL Server.Net.
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.
What is MySQL? MySQL is a relational database management system (RDBMS) based on SQL (Structured Query Language). First released in January, Many.
Chapter 4 Relational Database, Pivot Charts, and Switchboard.
Working with MySQL A290/A590, Fall /07/2014.
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
Using Database: A very, very short introduction..
COMPREHENSIVE Access Tutorial 1 Creating a Database.
Week 2 Lecture The Relational Database Model Samuel ConnSamuel Conn, Faculty Suggestions for using the Lecture Slides.
Visual Database Creation with MySQL Workbench 도시정보시스템 설계
Introduction to Database C# MySQL onnect-C-to-MySQL 1.
.NET Data Access and Manipulation
C# MySQL onnect-C-to-MySQL 1.
Database Programming Basic JDBC Programming Concepts.
INTRODUCTION TO DATABASES (MICROSOFT ACCESS)
Database Mysql Hayk Avdalyan.
Distributed Database Systems
© 2016, Mike Murach & Associates, Inc.
Database Management  .
Discrete Structures for Computer Science
MySQL Connection using ADO.Net
PHP and MySQL.
Presentation transcript:

1 11/8/05CS360 Windows Programming Databases and Data Representation

2 11/8/05CS360 Windows Programming Relationships  Relation: one-to-many 1ShereenCS DougCS ChrisCS JoshCS MikeCS NameCourseStudentsLectID 11Strain203C 24Marsh324 34Strain202 42Strain201 Building Room LectID Foreign key Primary key OfficeID

3 11/8/05CS360 Windows Programming Database Views  CREATE VIEW StrainOffices AS SELECT OfficeID, LectID, Room FROM Offices WHERE Building = ‘Strain’ 11Strain203C 24Marsh324 34Strain202 42Strain201 Building Room LectID OfficeID 11203C Room LectID OfficeID

4 11/8/05CS360 Windows Programming Database Views  Views do not store data – they are “virtual” tables  If we query a view, tuples are obtained from the base table so that the query can be answered  SELECT OfficeID, Room FROM StrainOffices WHERE LectID = C Room LectID OfficeID 1203C Room OfficeID

5 11/8/05CS360 Windows Programming Database Views  We can rename the columns in the view if we want  CREATE VIEW StrainOffices(OId, Lid, RoomNum) AS SELECT OfficeID, LectID, Room FROM Offices WHERE Building = ‘Strain’ 11203C RoomNum LId OId

6 11/8/05CS360 Windows Programming Database Joins 1ShereenCS DougCS ChrisCS JoshCS MikeCS NameCourseStudentsLectID 11Strain203C 24Marsh324 34Strain202 42Strain201 Building Room LectID Foreign key Primary key OfficeID

7 11/8/05CS360 Windows Programming Joins  SELECT * FROM Lectures INNER JOIN Offices ON Lecturers.LectID = Offices.LectID ORDER BY Offices.LectID LIdNameCourseStudentsOIdLIdBldRoom 1ShereenCS Strain203C 2DougCS Strain201 3ChrisCS JoshCS Marsh324 4JoshCS Strain202 5MikeCS

8 11/8/05CS360 Windows Programming Your Turn  SELECT Name FROM Lecturers INNER JOIN Offices ON Lecturers.LectID = Office.LectID INNER JOIN Advisees ON Lecturers.LectID = Advisees.AdvID WHERE Building = ‘Strain’ AND Name = ‘Harry’ 1ShereenCS DougCS ChrisCS JoshCS MikeCS NameCourseStudentsLectID 11Strain203C 24Marsh324 34Strain202 42Strain201 BuildingRoomLectIDOfficeID 11John 21Mike 31Harry 42Holly 52Ron NameLectIDAdvID

9 11/8/05CS360 Windows Programming Connecting to MySQL  C# can connect to MySQL  Need to download a.NET connector  et/1.0.html et/1.0.html  Need the MySql.Data.dll o I’ve placed it in CS360 Pub under MySQL Connector\bin\.NET 1.1

10 11/8/05CS360 Windows Programming Connecting to MySQL

11 11/8/05CS360 Windows Programming Connecting to MySQL using MySql.Data.MySqlClient; string connStr = "server=cs445.cs.pacificu.edu; user id=shereen; password=abc123; database=shereen;"; MySqlConnection conn = null; MySqlDataAdapter da = null; MySqlDataReader reader = null; MySqlCommand cmd = null;

12 11/8/05CS360 Windows Programming Connecting to MySQL try { conn = new MySqlConnection(connStr); conn.Open(); cmd = new MySqlCommand("SELECT * FROM pet", conn); reader = cmd.ExecuteReader(); lb2.Text = ""; while (reader.Read()) { lb2.Text = lb2.Text + reader.GetString(0) + "\n"; }

13 11/8/05CS360 Windows Programming Connecting to MySQL catch (MySqlException ex) { lb2.Text = "Exception accessing MySQL server: " + ex.Message; } catch (Exception ex) { lb2.Text = "Exception accessing database list: " + ex.Message; } finally { if (reader != null) reader.Close(); if (conn != null) conn.Close(); }

14 11/8/05CS360 Windows Programming