Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.

Slides:



Advertisements
Similar presentations
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Advertisements

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.
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.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Introduction To Form Builder
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.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Microsoft Access 2010 Chapter 7 Using SQL.
Overview What is SQL Server? Creating databases Administration Security Backup.
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 13 Managing Databases with SQL Server 2000.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
Databases and LINQ Visual Basic 2010 How to Program 1.
Chapter 10 Managing Data with ASP.NET. ASP.NET 2.0, Third Edition2.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
ASP.NET Programming with C# and SQL Server First Edition
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
Chapter 61 Managing Data Sources Introduction to ASP.NET By Kathleen Kalata.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Chapter 81 Building Data-Driven Web Applications Introduction to ASP.NET By Kathleen Kalata.
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
Database Technical Session By: Prof. Adarsh Patel.
Chapter 15: Using LINQ to Access Data in C# Programs.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
1 Chapter 7 Query-By-Example by Monica Chan CS157B Professor Lee.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
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.
1 Working with MS SQL Server Textbook Chapter 14.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Concepts of Database Management Seventh Edition
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
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.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
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.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Entity Framework Database Connection with ASP Notes from started/getting-started-with-ef-using-mvc/creating-an-
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
ASP.NET Programming with C# and SQL Server First Edition
Microsoft Access 2003 Illustrated Complete
ORACLE SQL Developer & SQLPLUS Statements
Chapter 6 System and Application Software
CIS16 Application Programming with Visual Basic
Chapter 11 Managing Databases with SQL Server 2000
Chapter 6 System and Application Software
Databases and Information Management
Chapter 6 System and Application Software
Chapter 6 System and Application Software
Presentation transcript:

Chapter 7 Managing Data Sources

ASP.NET 2.0, Third Edition2

 Data can be stored and formatted using a variety of tools and technologies  A relational database management system (RDBMS) is a system that stores data in related tables  An RDBMS may contain additional tools to help create and manage tables, and provide an interface for programmers to develop applications that can communicate with the database ASP.NET 2.0, Third Edition3

4

5

6

 There are three examples of popular relational databases  Microsoft Access  Microsoft Access stores the information in a single file and can only handle a few concurrent connections through the web, and is less secure than SQL Server  Microsoft SQL Server  Microsoft SQL Server is a robust database application that also allows you to create stored procedures and supports transactions  Oracle  Oracle databases commonly are used with web applications built with Java and PHP technologies ASP.NET 2.0, Third Edition7

 A variety of Visual Studio.NET tools allow you to create and manipulate a database  With these tools, you can create the database from scratch or convert the data from an existing format into a relational database  You can also import data from a spreadsheet into a Microsoft Access database  In addition, you can convert a Microsoft Access database to a SQL Server database ASP.NET 2.0, Third Edition8

 Visual Studio.NET provides a graphical user interface that you can use to create a connection to a database  When you create the database, you need to know the type of authentication required for access to the SQL Server  You can use the authentication built within Windows NT, or SQL Server authentication  You can create the database in either the Database Explorer window or the Solution Explorer window  If you create the database in the App_Data folder in the Solution Explorer window, then both the SQL Server data file and the transaction log are stored in the App_Data folder  This database can be easily moved by simply detaching the database from this instance of SQL Server and reattach it to another instance of SQL Server ASP.NET 2.0, Third Edition9

10

ASP.NET 2.0, Third Edition11

ASP.NET 2.0, Third Edition12

ASP.NET 2.0, Third Edition13

 TheVisual Studio.NET SQL Editor is used to create and edit views, SQL scripts, and stored procedures  Views and queries allow you to retrieve information from the database  Queries are SQL commands that retrieve data from the database  SQL scripts and stored procedures may contain the same SQL commands used in queries and views ASP.NET 2.0, Third Edition14

 Queries and views can both be used to retrieve data  A view is an SQL statement that is saved with the database as part of a database design  Views can contain only select statements, which means that views can retrieve data; they cannot be used to create, update, or delete data  View Designer is used to create and manage views and works only with SQL Server  A query is an SQL statement that is saved with a Visual Studio database project and not with the database  The Query Designer can be used to create, update, and delete data ASP.NET 2.0, Third Edition15

 The Query and View Designer allows you to create a query or view within Visual Studio.NET  To aid you in creating views and queries, there are four windows called panes displayed within the Query and View Designer  Diagram Pane  Grid Pane  SQL Pane  Results Pane ASP.NET 2.0, Third Edition16

 You can build and modify the SQL commands to retrieve a select group of records  To retrieve all the records in the Products table, you can use this SQL command:  SELECT * FROM Products  The keyword FROM is used to indicate the name of the table where the data is retrieved  You can retrieve the list of manufacturers by using the Select statement:  SELECT DISTINCT Manufacturers FROM Products  The view can use the keyword TOP to retrieve a subset of the records in the table:  SELECT TOP (50) PERCENT * FROM Products ASP.NET 2.0, Third Edition17

 You can use keywords to qualify a subset of records and columns to retrieve  The WHERE clause of a search condition consists of the keyword WHERE, an expression, a comparison operator, and another expression  Valid comparison operators include +,, <>, IS, and ISNOT  Example: WHERE Member='Staff' AND Salary>55000  The GROUP BY clause allows you to aggregate the records based on the values of one of the columns  Example: SELECT *FROM Products GROUP BY CategoryID  The JOIN clause allows you to combine one or more tables into a single set of records ASP.NET 2.0, Third Edition18

 “ of whole world: relating to or involving the entire world” (Encarta)  SQL Server file on web site in recordings directory   Various sources of country data ASP.NET 2.0, Third Edition19

 Country-City  Country-Ethnic  Country-Language ASP.NET 2.0, Third Edition20

 Stored procedures can be used to create an SQL command that is stored within the database  The stored procedure is more efficient than an SQL statement because it is precompiled by the server  Stored procedures are created within Visual Studio.NET  SQL Server scripts provide you with the ability to store SQL commands in an external text file  SQL Server scripts are often used to create and back up your SQL Server databases ASP.NET 2.0, Third Edition21

 A stored procedure can be used to run a SQL statement  A good technique is to pass values to the stored procedure that can be used in the SQL statement  The name of any parameter within a stored procedure always begins with symbol  An input parameter is a value that is passed to the stored procedure when it is called  The data type and length of this value must match the data type and length that is specified within the stored procedure  Output parameters can send values back to the object that called the stored procedure ASP.NET 2.0, Third Edition22

 You can have a return value passed back to the stored procedure call  The return code is indicated with the keyword RETURN and is often used to indicate the status of the query  By default, the return value is set to 0, which means the query execution was successful  When the value is 1, the required parameter value was not passed to the query  When the value is 2, the parameter passed was not valid ASP.NET 2.0, Third Edition23

 The SQL Query Builder has the same user interface as the Query and View Editor  The code to create the query, however, is stored in the stored procedure  Within the stored procedure, you can edit the blocks of code that are enclosed within a blue line, via the SQL Query Builder  You only need to right-click the block and select Design SQL Block ASP.NET 2.0, Third Edition24

 Built-in views and stored procedures allow you to retrieve information about your database  The sp_tables built-in stored procedure would return a list of tables in the database  The sp_columns built-in stored procedure would return the list of columns for the name of the table that is passed as a parameter to the stored procedure  You can access the stored system views and stored procedures in the Database Explorer  It is important to provide strong security for the SQL server, because some of the built-in stored procedures can be used maliciously if your SQL Server security has been breached ASP.NET 2.0, Third Edition25

 In order to create a connection to databases, one must know:  The parts of a connection string  How to store a connection string in the web configuration file  How to create a connection to the database from a web page  How to move data from Access to SQL Server ASP.NET 2.0, Third Edition26

 The connection string is a piece of text that contains the location of your database and any additional information required to access the database  The connection string format is different for each database because each database has different connection string requirements  When you use Visual Studio.NET to create a connection to a database, you will fill out the connection information using a dialog box, and the software will create the connection string for you  The following code is a sample of a connection string to a SQL Server database:  Data Source=.\SQLEXPRESS; AttachDbFilename="C:\[Yourfolder]\Chapter7\App_Data\ Chapter7.mdf”; Integrated Security=True; ASP.NET 2.0, Third Edition27

ASP.NET 2.0, Third Edition28

ASP.NET 2.0, Third Edition29

ASP.NET 2.0, Third Edition30

ASP.NET 2.0, Third Edition31

ASP.NET 2.0, Third Edition32

ASP.NET 2.0, Third Edition33

ASP.NET 2.0, Third Edition34

ASP.NET 2.0, Third Edition35

ASP.NET 2.0, Third Edition36

 Relational databases store data related tables. Tables consist of rows and columns. When you create the column, you must identify the data type, the file size, and if the column allows, null values.  Relationships between tables are defined in the Database Diagram. The primary key column contains a unique value for each row of data and is used to create the relationship in other tables. When values of primary keys are stored in other tables, they are called foreign keys.  Normalization is the process used to design databases, which will reduce redundancy, promote data integrity, and improve database performance.  You can use the Visual Database Tools within Visual Studio.NET to create and maintain your databases. ASP.NET 2.0, Third Edition37

 The Table Designer allows you to create tables and enter data.  The Query and View Designer allows you to create queries called views. Views are stored in the database and only are used with select statements. Queries must be executed manually but can contain INSERT, UPDATE, and DELETE statements.  The SQL Editor allows you to create stored procedures. Stored procedures are SQL commands that are stored with the SQL Server, and then compiled. Therefore, stored procedures run faster than SQL commands that are stored on a web page.  The SQL Query Builder allows you to use the visual tools to build your stored procedures. SQL Server scripts are files that contain SQL statements and are often used to create new databases and backup existing databases. ASP.NET 2.0, Third Edition38

 You can store the connection strings in the root level Web.config application configuration file making them available from any web page in the application using global application variables or the connectionStrings element.  The connection string syntax varies with each type of database. The connection string contains the information needed to identify the type of database, the location of the database, the software provider required to communicate with the database, and user permissions required to access the data in the database.  You can convert a Microsoft Access database to SQL Server using the upsizing wizard. ASP.NET allows you to create connections to non-Microsoft data sources such as XML files. ASP.NET 2.0, Third Edition39