DataSet Your Database student test score Database Connection Your program needs to establish a connection to the database. Click on “Add New Data Source.”

Slides:



Advertisements
Similar presentations
EZ Grade Pro Becky Koss French & Spanish Teacher Lake-Lehman Sr. High School.
Advertisements

Microsoft® Access® 2010 Training
1 After completing this lesson, you will be able to: Create a database. Create a table using the Table Wizard. Create and modify a table in Design view.
1.NET Web Forms DataGrid © 2002 by Jerry Post. 2 Data Grid Has Many Uses  The grid uses HTML tables to display multiple rows of data. It is flexible.
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Access Lesson 2 Creating a Database
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
EGR 141 Computer Problem Solving in Engineering and Computer Science Interfacing with a Database in Visual Basic.NET 2005.
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
Microsoft Access 2007 Microsoft Access 2007 Introduction to Database Programs.
Database Updates Made Easy In WebFocus Using SQL And HTML Painter Sept 2011 Lender Processing Services 1.
Access Tutorial 10 Automating Tasks with Macros
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
1 Access Lesson 1 Microsoft Access Basics Microsoft Office 2010 Introductory Pasewark & Pasewark.
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-1 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left,
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 1Advanced Tables, Relationships, Queries, and Forms Chapter 3Advanced Query Techniques.
MBAC 611.  Click on the My Computer Icon  Open your private network directory  Create a new folder named lab7  Copy your lab6 Access file to the lab7.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Advanced Forms Lesson 10.
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
CSS/417 Introduction to Database Management Systems Workshop 2.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
Office Management Tools II Ms Saima Gul.  When you create your tables, you should assign each table a primary key—one or more fields whose contents are.
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
Database Systems Microsoft Access Practical #3 Queries Nos 215.
CSC 240 (Blum)1 Forms and Importing Data in Access.
CSC 240 (Blum)1 Introduction to Data Entry, Queries and Reports.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T7 PROBLEM SOLVING USING ACCESS.
Microsoft Access. Microsoft access is a database programs that allows you to store retrieve, analyze and print information. Companies use databases for.
O FFICE M ANAGEMENT T OOL - II B BA -V I TH. Abdus Salam2 Week-7 Introduction to Query Introduction to Query Querying from Multiple Tables Querying from.
1 Chapter 20 – Data sources and datasets Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Mauricio Featherman, Ph.D. Washington St. University
Basic & Advanced Reporting in TIMSNT ** Part Three **
CHAPTER 1 – INTRODUCTION TO ACCESS Aliya Farheen March 5, 2014.
Gold – Crystal Reports Introductory Course Cortex User Group Meeting New Orleans – 2011.
T7-1 LEARNING OUTCOMES – ACCESS PROBLEM SOLVING 1.Describe the process of using the Simple Query Wizard using Access 2.Describe the process of using the.
Creating a Database Angelo Lafratta- Website: Search: Keith Valley Physical.
Work with Tables and Database Records Lesson 3. NAVIGATING AMONG RECORDS Access users who prefer using the keyboard to navigate records can press keys.
Chapter 24 I’m Suffering from Information Overload (Access Databases) Clearly Visual Basic: Programming with Visual Basic nd Edition.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
Progress and Outcome Measures - Part 3 Progress and Outcome Measures Part 3, Slide 1Copyright © 2004, Jim Schwab, University of Texas at Austin.
Access Module Implementing a Database with Microsoft Access A Great Module on Your CD.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
Introduction to EBSCOhost
Objectives Query for top values Create a parameter query
Plug-In T7: Problem Solving Using Access 2007
Objectives Create an action query to create a table
Find and Replace Used to quickly find and/or replace data quickly
Creating and Modifying Queries
Microsoft Official Academic Course, Access 2016
CIS16 Application Programming with Visual Basic
Computer Science Projects Database Theory / Prototypes
September 12-14, 2018 Raleigh, NC.
Topic 12 Lesson 2 – Retrieving Data with Queries
Tutorial 9 Using Action Queries and Advanced Table Relationships
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

DataSet Your Database student test score Database Connection Your program needs to establish a connection to the database. Click on “Add New Data Source.”

DataSet Your Database student test score student test score Database Connection When you select the tables to import into the database via the connection, copies of them are created inside the DataSet.

DataSet Your Database student test score student test score Database Connection These tables are a local copy of the DataSet. When you change data inside the program, changes are made to the local copy. The database is not updated until explicitly told to do so. With the drag and drop graphical interface we will be using, this will be handled for us.

You can see these tables in your dataset with “Show Data Sources” which opens this view Or you can click on the.xsd file, and click “View Designer,” which opens this view

This view now shows not only the tables, but also the relationships that they share, which you build into the original database with the foreign keys. If you look closely, you can see a key at one end of the relationship line. This key shows the end of the relationship which is the controlling, or ‘parent’ source.

Let’s add a list box of all the students to our form. Click on “Data Sources,” and change student to display as “List Box.” Drag and Drop onto the form. The List Box appears on our form, and is already tied to the DataSet, and the database. If you click on the itsy-bitsy arrow at the top corner, you can see the settings.

Notice that “Display Member” is set to “first_name,” while “Value Member” is set to “sid.” This is so that, even though “first_name” may not be a unique field, the program can actually uniquely identify each row, because the row’s sid key is ‘hidden’ underneath, and is the real identifier. Notice also that the drop down box can only display one field. If you want multiple fields to display, you will need to use a datagrid.

Instead, let’s delete Form1, start with a clean form, and use a “details” view. Now, let’s show the tests each student took. I can simply click on Score (the table that is the subset of students) and drag and drop a grid onto my form.

If I were to click on the ‘score’ Table which was not a subset of ‘student,’ then all my data would appear for every student, not just the student at hand. If you don’t want to show all the columns in a table, you don’t have to. Right click and select “edit columns” to remove extras.

Running the program now looks like this! Because I did use the ‘scores’ table that was a subset of student, the only scores records which show are ones sharing the foreign key with the students – the sid field. You can successfully click through the records, as well as modify (student, not score) data. Make sure that you click the SAVE icon before exiting your database, because that is where the DataSet uploads it’s changes to the Database. Until then, none of your changes are permanent!

For Score, I have used a TID, or Test ID, as my test key instead of a name. Now, it is difficult to understand what test we are talking about. In order to view data from both score and test tables (so we can see the test_name for each score record) we will need to create a Query, and a new table.

In a database, we can combine tables based on their keys, and create a combined table. This process is called a ‘join.’ SIDFirstLast 11JoanSmith 12JimBarney 13JackBlack SIDTestScore 11MT100 11Final75 12MT92 12Final88 StudentScore Join on “SID” SIDFirstLastTestScore 11JoanSmithMT100 11JoanSmithFinal75 12JimBarneyMT92 12JimBarneyFinal88 As you can see, there are no rows for Jack Black, because he did not have any scores in the score table.

The Query to create this table in SQL is: “SELECT * FROM student, score WHERE student.sid = score.sid;” Or it’s equivalent: “SELECT * FROM score INNER JOIN student ON score.sid = student.sid;” Instead of SELECT *, we can choose the columns that we want to appear. Lets say we only want columns First and Score. Our Query would then look like this: “SELECT student.first, score.score FROM student, score WHERE student.sid = score.sid;” FirstScore Joan100 Joan75 Jim92 Jim88

These queries will be useful in our program. If you want to display a grid that holds data from multiple tables, you will first need to create the query. 1)Go into your DataSet Design, and right click in the blue area. Select “Table Adapter.” 2)Accept the default connection, and select “Use SQL Statements.” 3)Click on the “Query Builder” button. 4)Add the tables that you will be using for this query and say CLOSE. 5)In each of the tables that appeared in your query builder, click the boxes of the values you will be using. The Query Builder writes the SQL statement for you!

As you can see, the “Create methods to send updates directly to the database” is grayed out. This means this table can be used for viewing data, but not for updating the database.

You can try and add a relation for your new table by right clicking on the blue background... But you’ll notice that you cannot relate two tables if the child table does not include the parent’s key – in this case, the SID field.

But if you delete the table and start over, this time including the student.sid field, Your table will actually appear with the relation already in place! Note – you can edit grids in the program so that they only display the fields that you want to see.

So then after creating a table adapter (DataTable2) which contained both score and test tables, and creating a relation between student and DataTable2 on the sid field, I was able to drop a grid in which shows both the score and the test name, instead of just tid. The form, executing:

Let’s say we have a Menu form and a Students form Add a button to Menu, and double click it to get into it’s code. Then type: Students studentForm = new Students(); //New instance of form class studentForm.show(); // launches form How about a menu table? How do we open one form from another?